<?php
use backend\models\Attributesvalues;
use modules\custom\models\Accounts;
use modules\users\models\User;
use kartik\date\DatePicker;
use kartik\select2\Select2;
use kartik\time\TimePicker;
use kartik\typeahead\Typeahead;
use kartik\typeahead\TypeaheadBasic;
//data from other models
use yii\bootstrap4\Modal; //drop down options
use yii\helpers\Arrayhelper; //client accounts
use yii\helpers\Html; //user accounts

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


//Select2 user query
$users = User::Employeesu();

$wearav = Attributesvalues::formarray('wear');
$milemeters = Attributesvalues::formarray('milemeters');
$yardschain = Attributesvalues::formarray('yardschain');
$trackid = Attributesvalues::formarray('trackid');
$yesno = Attributesvalues::formarray('yesno');
$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'); 
$passfail = Attributesvalues::formarray('passfail'); 
$location = Attributesvalues::formarray('location');
$rail = Attributesvalues::formarray('rail');
$linespeed = Attributesvalues::formarray('linespeed');
$sleeper = Attributesvalues::formarray('sleeper');



$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 


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="wel233-form">

    <?php $form = ActiveForm::begin();?>
    <div hidden="yes">
        <div class="DarkerBlue">Job Number</div>
        <div><?=$form->field($model, 'injobno')->textInput(['maxlength' => 100, 'id' => 'injobno'])->label(false)?>
        </div>
        <div class="DarkerBlue">Client</div>
        <div>
            <?=$form->field($model, 'client')->dropDownList(ArrayHelper::map(Accounts::find()->where("status <> ''")->all(), 'AccountID', 'Account_Name'), ['readonly' => 'true', 'id' => 'client', 'prompt' => 'Please Select'])->label(false)?>
        </div>
    </div>
    <table class="Table">
        <tr>
            <td class="Title">Balfour Beatty</td>
            <td class="Title" colspan="2" style="text-align: Center">Weld Installation Sheet</td>
            <td style="text-align: Right">Aluminothermic Weld Installation <br />
                Standard Form: OPS-SF-6353d-RAIL</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Senior Welding Coordinator</td>
            <td><?=$form->field($model, 'seniorweldingcoordinator')->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td class="DarkerBlue">Sheet</td>
            <td style="width: 25%">
                <table class="Table">
                    <tr>
                        <td><?=$form->field($model, 'sheet')->textInput(['maxlength' => 100])->label(false)?></td>
                        <td>of</td>
                        <td><?=$form->field($model, 'sheet2')->textInput(['maxlength' => 100])->label(false)?></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Week Number</td>
            <td><?=$form->field($model, 'weekno')->textInput(['maxlength' => 100])->label(false)?></td>
            <td class="DarkerBlue">Job Cost Number</td>
            <td><?=$form->field($model, 'jcn')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Site</td>
            <td>
                <?=$form->field($model, 'site')->textInput(['maxlength' => 100, 'id' => 'location'])->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><?=$form->field($model, 'gkitno')->dropDownList(Attributesvalues::formarray('gaskitno'), ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td class="DarkerBlue">Welding Company</td>
            <td>Inline Track Welding Limited</td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Welders Name (Print)
            </td>
            <td>
                <?=$form->field($model, 'weldersname')->dropdownlist($users,
                    [
                        'id' => 'weldername',
                        'prompt' => 'Select Operative',
                        'class' => 'custom-select'
                    ],
                )->label(false)?>
            </td>
            <td class="DarkerBlue">
                Welders Assistant Name
            </td>
            <td>
                <?=$form->field($model, 'weldersastname')->dropdownlist($users,
                    [
                        'id' => 'weldernameast',
                        'prompt' => 'Select Operative',
                        'class' => 'custom-select'
                    ],
                )->label(false)?>
            </td>
        </tr>
    </table>
    <br>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td class="DarkerBlue"></td>
            <td></td>
            <td colspan="2">Weld 1</td>
            <td colspan="2">Weld 2</td>
            <td colspan="2">Weld 3</td>
            <td colspan="2">Weld 4</td>
        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Weld Database Number</td>
            <td colspan="2">
                <?=$form->field($model, 'welddbno1')->textInput(['maxlength' => 100,])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'welddbno2')->textInput(['maxlength' => 100,])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'welddbno3')->textInput(['maxlength' => 100,])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'welddbno4')->textInput(['maxlength' => 100,])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" colspan="2">Date weld cast</td>
            <td colspan="2">
                <?= $form->field($model, 'w1date')->widget(DatePicker::class, [ 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w2date')->widget(DatePicker::class, [ 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w3date')->widget(DatePicker::class, [ 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w4date')->widget(DatePicker::class, [ 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Time weld cast</td>
            <td colspan="2">
                <?= $form->field($model, 'w1time')->widget(TimePicker::class, [ 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w2time')->widget(TimePicker::class, [ 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w3time')->widget(TimePicker::class, [ 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'w4time')->widget(TimePicker::class, [ 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
        </tr>
        <td class="DarkerBlueC" rowspan="9">
            <div class="rotate">Location</div>
        </td>
        <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">Chord Point</td>
            <td colspan="2">
                <?=$form->field($model, 'chord1')->textInput(['maxlength' => 100, 'placeholder' => 'N/A'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'chord2')->textInput(['maxlength' => 100, 'placeholder' => 'N/A'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'chord3')->textInput(['maxlength' => 100, 'placeholder' => 'N/A'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'chord4')->textInput(['maxlength' => 100, 'placeholder' => 'N/A'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Mileage</td>
            <td colspan="8">
                <table class="Table">
                    <td colspan="">
                        <Table>
                            <tr>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage1')->textInput(['id' => 'm1'])->label(false)?></td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage2')->dropDownList($milemeters, ['id' => 'm2', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage3')->textInput(['id' => 'm3', 'maxlength' => 100])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage4')->dropDownList($yardschain, ['id' => 'm4', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                            </tr>
                        </Table>
                    </td>
                    <td colspan="">
                        <Table>
                            <tr>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage5')->textInput(['id' => 'm5'])->label(false)?></td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage6')->dropDownList($milemeters, ['id' => 'm6', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage7')->textInput(['id' => 'm7', 'maxlength' => 100])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage8')->dropDownList($yardschain, ['id' => 'm8', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                            </tr>
                        </Table>
                    </td>
                    <td colspan="">
                        <Table>
                            <tr>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage9')->textInput(['id' => 'm9'])->label(false)?></td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage10')->dropDownList($milemeters, ['id' => 'm10', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage11')->textInput(['id' => 'm11', 'maxlength' => 100])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage12')->dropDownList($yardschain, ['id' => 'm12', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                            </tr>
                        </Table>
                    </td>
                    <td colspan="">
                        <Table>
                            <tr>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage13')->textInput(['id' => 'm13'])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage14')->dropDownList($milemeters, ['id' => 'm14', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage15')->textInput(['id' => 'm15', 'maxlength' => 100])->label(false)?>
                                </td>
                                <td style="width: 6.75%">
                                    <?=$form->field($model, 'mileage16')->dropDownList($yardschain, ['id' => 'm16', 'prompt' => 'Please Select...'])->label(false)?>
                                </td>
                            </tr>
                        </Table>
                    </td>
                </table>

            </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 colspan="2" class="LighterBlue">
                <?=$form->field($model, 'btol1')->dropDownList($rail, ['prompt' => 'Please Select', 'id' => 'rail1'])->label(false)?>
            </td>
            <td colspan="2" class="LighterBlue">
                <?=$form->field($model, 'btol2')->dropDownList($rail, ['prompt' => 'Please Select', 'id' => 'rail2'])->label(false)?>
            </td>
            <td colspan="2" class="LighterBlue">
                <?=$form->field($model, 'btol3')->dropDownList($rail, ['prompt' => 'Please Select', 'id' => 'rail3'])->label(false)?>
            </td>
            <td colspan="2" class="LighterBlue">
                <?=$form->field($model, 'btol4')->dropDownList($rail, ['prompt' => 'Please Select', 'id' => 'rail4'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">open,lineside,tunnel,platform <span class="fa fa-plus btn-attributes float-right"
                    data-value="location"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'type1')->dropDownList($location, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'type2')->dropDownList($location, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'type3')->dropDownList($location, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'type4')->dropDownList($location, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Line speed <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">Sleeper type<span class="fa fa-plus btn-attributes float-right"
                    data-value="sleeper"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'sleeper1')->dropDownList($sleeper, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'sleeper2')->dropDownList($sleeper, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'sleeper3')->dropDownList($sleeper, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'sleeper4')->dropDownList($sleeper, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Consolidated <span class="fa fa-plus btn-attributes float-right"
                    data-value="yesno"></span></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="DarkerBlueC" rowspan="4">
                <div class="rotate">Rail Details</div>
            </td>
            <td class="DarkerBlue">(Four foot facing rail) Rail</td>
            <td class="LighterBlue">L/H Rail</td>
            <td class="LighterBlue">R/H Rail</td>
            <td class="LighterBlue">L/H Rail</td>
            <td class="LighterBlue">R/H Rail</td>
            <td class="LighterBlue">L/H Rail</td>
            <td class="LighterBlue">R/H Rail</td>
            <td class="LighterBlue">L/H Rail</td>
            <td class="LighterBlue">R/H Rail</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="DarkerBlueC" rowspan="3">
                <div class="rotate">Rail Prep</div>
            </td>
            <td class="DarkerBlue">Gap preparation method<span class="fa fa-plus btn-attributes float-right"
                    data-value="cuttingmethod"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'gapprep1')->dropDownList($cuttingmethod, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'gapprep2')->dropDownList($cuttingmethod, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'gapprep3')->dropDownList($cuttingmethod, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'gapprep4')->dropDownList($cuttingmethod, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Welding gap</td>
            <td colspan="2">
                <table>
                    <tr>
                        <td><?=$form->field($model, 'gap1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                    </tr>
                </table>
            </td>
            <td colspan="2">
                <table>
                    <tr>
                        <td><?=$form->field($model, 'gap2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap9')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap10')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                    </tr>
                </table>
            </td>
            <td colspan="2">
                <table>
                    <tr>
                        <td><?=$form->field($model, 'gap3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap11')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap12')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap13')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                    </tr>
                </table>
            </td>
            <td colspan="2">
                <table>
                    <tr>
                        <td>
                        <td><?=$form->field($model, 'gap4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap14')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap15')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                        <td><?=$form->field($model, 'wgap16')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['local' => $wear, 'limit' => 10]]])->label(false);?>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Aligment method<span class="fa fa-plus btn-attributes float-right"
                    data-value="alignment"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'align1')->dropDownList($alignment, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'align2')->dropDownList($alignment, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'align3')->dropDownList($alignment, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'align4')->dropDownList($alignment, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC" rowspan="11">
                <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">
                <?=$form->field($model, 'railtemp2', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'railtemp3', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td colspan="2">
                <?=$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 used <span class="fa fa-plus btn-attributes float-right"
                    data-value="fuelgas"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'fuelgused1')->dropDownList($fuelgas, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'fuelgused2')->dropDownList($fuelgas, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'fuelgused3')->dropDownList($fuelgas, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'fuelgused4')->dropDownList($fuelgas, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Portion</td>
            <td colspan="2"><?=$form->field($model, 'portion1')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'portion2')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'portion3')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'portion4')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Batch Number</td>
            <td colspan="2"><?=$form->field($model, 'pbn1')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pbn2')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pbn3')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pbn4')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Gap Dimensions Head</td>
            <td colspan="2">
                <?=$form->field($model, 'gapdhead1')->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, 'gapdhead2')->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, 'gapdhead3')->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, 'gapdhead4')->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">Gap Dimensions Web</td>
            <td colspan="2">
                <?=$form->field($model, 'gapdweb1')->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, 'gapdweb2')->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, 'gapdweb3')->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, 'gapdweb4')->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">Gap Dimensions Foot</td>
            <td colspan="2">
                <?=$form->field($model, 'gapdfoot1')->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, 'gapdfoot2')->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, 'gapdfoot3')->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, 'gapdfoot4')->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">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">Welders Stamp Number</td>
            <td colspan="2">
                <?=$form->field($model, 'wstampno1')->textInput(['maxlength' => 100, 'id' => 'stamp1'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'wstampno2')->textInput(['maxlength' => 100, 'id' => 'stamp2'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'wstampno3')->textInput(['maxlength' => 100, 'id' => 'stamp3'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'wstampno4')->textInput(['maxlength' => 100, 'id' => 'stamp4'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC" rowspan="3">
                <div class="rotate">Tensors</div>
            </td>
            <td class="DarkerBlue">Kit Number</td>
            <td colspan="2"><?=$form->field($model, 'kitno1')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'kitno2')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'kitno3')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'kitno4')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Pressure at end of preheat</td>
            <td colspan="2"><?=$form->field($model, 'pressurep1')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressurep2')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressurep3')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressurep4')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Pressure after shearing</td>
            <td colspan="2"><?=$form->field($model, 'pressures1')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressures2')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressures3')->textInput(['maxlength' => 100])->label(false)?></td>
            <td colspan="2"><?=$form->field($model, 'pressures4')->textInput(['maxlength' => 100])->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC" rowspan="5">
                <div class="rotate">Welder Insp</div>
            </td>
            <td class="DarkerBlue">Insp as per NR/L2/TRK/0032 <span class="fa fa-plus btn-attributes float-right"
                    data-value="passfail"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'nrtrk1')->dropDownList($passfail, ['id' => 'noncon1', 'onchange' => 'noncon1j()', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'nrtrk2')->dropDownList($passfail, ['id' => 'noncon2', 'onchange' => 'noncon2j()', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'nrtrk3')->dropDownList($passfail, ['id' => 'noncon3', 'onchange' => 'noncon3j()', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'nrtrk4')->dropDownList($passfail, ['id' => 'noncon4', 'onchange' => 'noncon4j()', 'prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Non conformance form <span class="fa fa-plus btn-attributes float-right"
                    data-value="yesno"></span></td>
            <td colspan="2">
                <?=$form->field($model, 'ncfr1')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'ncfr2')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'ncfr3')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'ncfr4')->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">MAC's reported to site manager</td>
            <td colspan="2">
                <?=$form->field($model, 'macsreported1')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'macsreported2')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'macsreported3')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'macsreported4')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>

        </tr>
        <tr>
            <td class="DarkerBlue">20mph ESR required</td>
            <td colspan="2">
                <?=$form->field($model, 'esr1')->dropDownList($yesno, ['id' => 'esr1', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'esr2')->dropDownList($yesno, ['id' => 'esr2', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'esr3')->dropDownList($yesno, ['id' => 'esr3', 'prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'esr4')->dropDownList($yesno, ['id' => 'esr4', 'prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC" rowspan="3">
                <div class="rotate">Final Insp</div>
            </td>
            <td class="DarkerBlue">Insp as per NR/L2/TRK/0032</td>
            <td colspan="2">
                <?=$form->field($model, 'insnrtrk1')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'insnrtrk2')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'insnrtrk3')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'insnrtrk4')->dropDownList($yesno, ['prompt' => 'Please Select'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Result of Inspection</td>
            <td colspan="2">
                <?=$form->field($model, 'result1')->dropDownList($passfail, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'result2')->dropDownList($passfail, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'result3')->dropDownList($passfail, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'result4')->dropDownList($passfail, ['prompt' => 'Please Select'])->label(false)?>
            </td>

        </tr>
        <tr>
            <td class="DarkerBlue">Report Number</td>
            <td colspan="2">
                <?= $form->field($model, 'inspreportno1')->textInput()->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'inspreportno2')->textInput()->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'inspreportno3')->textInput()->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'inspreportno4')->textInput()->label(false);?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" align="right"></td>
            <td class="DarkerBlue">Shift Details</td>
            <td class="" colspan="">
                <?=$form->field($model, 'shift')->dropdownlist($shift = ['Night' => 'Night', 'Day' => 'Day', 'Back' => 'Back'], ['id' => 'shift'])->label(false)?>
            </td>

            <td class="DarkerBlue">Day:- <?= Date('D', strtotime($model->insdate)) ?></td>
            <td class="DarkerBlue">Date:- </td>
            <td><?= $form->field($model, 'insdate')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>

            <td class="DarkerBlue">Start Time:- </td>
            <td><?=$form->field($model, 'shiftfrom')->widget(TimePicker::class, ['pluginOptions' => ['showMeridian' => false]])->label(false);?>
            </td>
            <td class="DarkerBlue">End Time:-</td>
            <td><?=$form->field($model, 'shiftto')->widget(TimePicker::class, [ 'pluginOptions' => ['showMeridian' => false, 'value' => $model->finishtime]])->label(false);?>
            </td>

            <script>
            function getday1() {
                var date1 = document.getElementById('wel233-Date');
                alert(starttime)
                var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
                var day = days[date1.getDay()];
                alert(day)
                document.getElementById('day').value = day
            }
            </script>
        </tr>

        <tr>
            <td colspan="11"> &nbsp;</td>
        </tr>
        <tr>
            <td colspan="11" class="Title">
                IF THE WELD DOES NO COMPLY WITH NR/L2TRK/0032 FOR ANY REASON THE WELD SHALL BE CLAMPED
            </td>
        </tr>

        <tr>


            <td class="DarkerBlue">
            </td>
            <td class="DarkerBlue">
                Track Welders Name:-
            </td>
            <td>
                <?=$form->field($model, 'trackweldername1')->TextInput(['id' => 'trackweldername1'])->label(false)?>
            </td>
            <td class="DarkerBlue">
                Signed:-
                <span class="float-right">
                    <?=Html::button('Reset', ['class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(2);']);?>
                </span>
            </td>
            <td>
                <div id="canvas2">
                    <canvas id="canvas_2" class="canvas1"></canvas>
                </div>

                <span class="d-none">
                    <?=$form->field($model, 'wsignatureloc')->hiddenInput(['id' => 'wsignatureloc'])->label(false)?>
                </span>
            </td>
            <td class="DarkerBlue">
                Date:
            </td>
            <td>
                <?=$form->field($model, 'trackwelderdate1')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
            <td class="DarkerBlue">
                Stamp Number
            </td>
            <td colspan="2">
                <?=$form->field($model, 'trackwelderstampno1')->TextInput(['id' => 'trackwelderstampno1'])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
            </td>
            <td class="DarkerBlue">
                Track Welders Name:-
            </td>
            <td>
                <?=$form->field($model, 'trackweldername2')->TextInput(['id' => 'trackweldername2'])->label(false)?>
            </td>
            <td class="DarkerBlue">
                Signed:-
                <span class="float-right">
                    <?=Html::button('Reset', ['class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(3);']);?>
                </span>
            </td>
            <td>
                <div id="canvas3">
                    <canvas id="canvas_3" class="canvas1"></canvas>
                </div>
                <span class="d-none">
                    <?=$form->field($model, 'wasignatureloc')->hiddenInput(['id' => 'signcc'])->label(false)?>
                </span>
            </td>
            <td class="DarkerBlue">
                Date:
            </td>
            <td>
                <?=$form->field($model, 'trackwelderdate2')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
            <td class="DarkerBlue">
                Stamp Number
            </td>
            <td colspan="2">
                <?=$form->field($model, 'trackwelderstampno2')->TextInput(['id' => 'trackwelderstampno2'])->label(false)?>
            </td>
        </tr>

        <tr>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue">Tech Officier Name:-</td>
            <td colspan="1">
                <?=$form->field($model, 'repname')->textInput(['maxlength' => 100, 'id' => 'contact'])->label(false)?>
            </td>
            <td class="DarkerBlue">Person in Charge:-</td>
            <td colspan="1">
                <?=$form->field($model, 'personincharge')->textInput(['maxlength' => 100, 'id' => 'contact'])->label(false)?>
            </td>
            <td class="DarkerBlue">Signed:-
                <span class="float-right">
                    <?=Html::button('Reset', ['class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(1);']);?>
                </span>
            </td>
            <td>
                <div id="canvas1">
                    <canvas id="canvas_1" class="canvas1"></canvas>
                </div>
                <span class="d-none">
                <?=$form->field($model, 'signatureloc')->hiddenInput(['id' => 'signatureloc'])->label(false)?>
                </span>
            </td>
            
            <td class="DarkerBlue">
                Date:
            </td>
            <td colspan="2">
                <?=$form->field($model, 'trackwelderdate3')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['format' => 'dd/mm/yyyy', 'todayHighlight' => true]])->label(false);?>
            </td>
        </tr>





        <tr>
            <td colspan="10">Verifing that the above welds have been installed</td>

        </tr>
        <tr>
            <td colspan="5">Document Authoriser: David Swallow </td>
            <td colspan="5" align="right">Uncontrolled when printed or downloaded </td>
        </tr>
        <tr>
            <td colspan="3">Date of Issue: 02/12/2019</td>
            <td colspan="2">Page 1 of 1</td>
            <td colspan="2">Version: 1.3</td>
            <td colspan="3" align="right">A Balfour Beatty Rail Document</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-primary', 'onclick' => 'saveImage9()'])?>
    </div>

    <?php ActiveForm::end();?>
    <?php Modal::begin(['id' => 'modal',
    'size' => 'modal-lg']);
echo "<div id='modalContent'></div>";
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('wel233-insdate').value; //Date
    var6 = document.getElementById('client').value;
    var7 = document.getElementById('wel233-starttime').value; //startdate
    var8 = document.getElementById('wel233-finishtime').value; //finishdate
    var9 = document.getElementById('actid').value;
    var14 = document.getElementById('wel233-weldersname').value;
    var date = document.getElementById('wel233-w1date').value;


    //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 + "&welders=" + var14 + "&stamp=" + "&date=" +
        date;


    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 noncon1j() {
    var noncon1 = document.getElementById('noncon1').value
    //var1 = document.getElementById('nonconr1').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    var4 = document.getElementById('wel233-w1date').value;
    var5 = document.getElementById('location').value;
    var6 = document.getElementById('client').value;
    var7 = document.getElementById('esr1').value;
    //var8 = document.getElementById('welders').value;
    var9 = "<?= $model->actid ?>";
    var10 = document.getElementById('m1').value;
    var11 = document.getElementById('m2').value;
    var12 = document.getElementById('m3').value;
    var13 = document.getElementById('m4').value;
    var14 = document.getElementById('weldername').value;
    var stamp = document.getElementById('stamp1').value;
    var trackid = document.getElementById('trackid1').value;
    var rail = document.getElementById('rail1').value;
    var date = document.getElementById('wel233-w1date').value;

    URL = "?contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 + "&esr=" + var7 +
        "&weld=1" + "&actid=" + var9 + "&m1=" + var10 + "&m2=" + var11 + "&m3=" + var12 + "&m4=" + var13 + "&welders=" +
        var14 + "&stamp=" + stamp + "&date=" + date + "&trackid=" + trackid + "&rail=" + rail;
    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 noncon2j() {
    var noncon1 = document.getElementById('noncon2').value
    //var1 = document.getElementById('nonconr1').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 = document.getElementById('esr1').value;
    //var8 = document.getElementById('welders').value;
    var9 = "<?= $model->actid ?>";
    var10 = document.getElementById('m5').value;
    var11 = document.getElementById('m6').value;
    var12 = document.getElementById('m7').value;
    var13 = document.getElementById('m8').value;
    var14 = document.getElementById('weldername').value;
    var stamp = document.getElementById('stamp2').value;
    var trackid = document.getElementById('trackid2').value;
    var rail = document.getElementById('rail2').value;
    var date = document.getElementById('wel233-w2date').value;

    URL = "?contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 + "&esr=" + var7 +
        "&weld=1" + "&actid=" + var9 + "&m1=" + var10 + "&m2=" + var11 + "&m3=" + var12 + "&m4=" + var13 + "&welders=" +
        var14 + "&stamp=" + stamp + "&date=" + date + "&trackid=" + trackid + "&rail=" + rail;
    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('nonconr1').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 = document.getElementById('esr1').value;
    //var8 = document.getElementById('welders').value;
    var9 = "<?= $model->actid ?>";
    var10 = document.getElementById('m9').value;
    var11 = document.getElementById('m10').value;
    var12 = document.getElementById('m11').value;
    var13 = document.getElementById('m12').value;
    var14 = document.getElementById('weldername').value;
    var stamp = document.getElementById('stamp3').value;
    var trackid = document.getElementById('trackid3').value;
    var rail = document.getElementById('rail3').value;
    var date = document.getElementById('wel233-w3date').value;

    URL = "?contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 + "&esr=" + var7 +
        "&weld=1" + "&actid=" + var9 + "&m1=" + var10 + "&m2=" + var11 + "&m3=" + var12 + "&m4=" + var13 + "&welders=" +
        var14 + "&stamp=" + stamp + "&date=" + date + "&trackid=" + trackid + "&rail=" + rail;

    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('nonconr1').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 = document.getElementById('esr1').value;
    //var8 = document.getElementById('welders').value;
    var9 = "<?= $model->actid ?>";
    var10 = document.getElementById('m13').value;
    var11 = document.getElementById('m14').value;
    var12 = document.getElementById('m15').value;
    var13 = document.getElementById('m16').value;
    var14 = document.getElementById('weldername').value;
    var stamp = document.getElementById('stamp4').value;
    var trackid = document.getElementById('trackid4').value;
    var rail = document.getElementById('rail4').value;
    var date = document.getElementById('wel233-w4date').value;

    URL = "?contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 + "&esr=" + var7 +
        "&weld=1" + "&actid=" + var9 + "&m1=" + var10 + "&m2=" + var11 + "&m3=" + var12 + "&m4=" + var13 + "&welders=" +
        var14 + "&stamp=" + stamp + "&date=" + date + "&trackid=" + trackid + "&rail=" + rail;

    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 saveImage9() {
    var canvas_3 = document.getElementById('canvas_3');
    var data = canvas_3.toDataURL();
    document.getElementById("signcc").value = data;
    saveImage10();
    saveImage11();
}

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

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

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


$('#weldername').on('change', function(ev){
    $.ajax({
        url: '/user/getdetails',
        data: {username: $(this).val()},
        method: 'get',
        success: function (result, b, c){
            $('#trackweldername1').val(result.fullname)
            $('#trackwelderstampno1').val(result.stampno)
        }
    })
})
$('#weldernameast').on('change', function(ev){
    $.ajax({
        url: '/user/getdetails',
        data: {username: $(this).val()},
        method: 'get',
        success: function (result, b, c){
            $('#trackweldername2').val(result.fullname)
            $('#trackwelderstampno2').val(result.stampno)
        }
    })
})

</script>
