<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\imagine\Image;
use yii\bootstrap4\Modal;
use kartik\widgets\TimePicker;
use kartik\widgets\DateTimePicker;
use kartik\widgets\DatePicker;

/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt125 */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="dt122-view">

    <table class="Table notbb nolb norb">
        <tr>
            <td colspan="9" rowspan="2" style="padding:none;">
                <?= $this->render('//common/_viewheader', ['title' => 'Thermic Weld Inspection Form (DT122)']) ?>
            </td>
            <td colspan="3" class="DarkerBlue">Pad no</td>
        </tr>
        <tr>
            <td colspan="3"><?= $model->padno ?></td>
        </tr>

        <tr>
            <td colspan="2" class="DarkerBlue">Inline Job No</td>
            <td colspan="2" class="DarkerBlue">Weld ID</td>
            <td colspan="2" class="DarkerBlue">Date Installed</td>
            <td colspan="2" class="DarkerBlue">Site</td>
            <td colspan="2" class="DarkerBlue">ELR</td>
            <td colspan="2" class="DarkerBlue">Track ID</td>
        </tr>
        <tr>
            <td colspan="2"><?= $model->injobno ? $model->injobno : '&nbsp;'  ?></td>
            <td colspan="2"><?= $model->weldid ?></td>
            <td colspan="2"><?= $model->dateinspected ?></td>
            <td colspan="2"><?= $model->site ?></td>
            <td colspan="2"><?= $model->elr ?></td>
            <td colspan="2"><?= $model->trackid ?></td>
        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Mileage</td>
            <td colspan="2" class="DarkerBlue">Rail LH/RH</td>
            <td colspan="2" class="DarkerBlue">Company</td>
            <td colspan="2" class="DarkerBlue">Welder Depot</td>
            <td colspan="2" class="DarkerBlue">Stamp No</td>
            <td colspan="2" class="DarkerBlue">Weld Process</td>
        </tr>
        <tr>
            <td colspan="2"><?= $model->mileage ?></td>
            <td colspan="2"><?= $model->raillhrh ?></td>
            <td colspan="2"><?= $model->account ? $model->account->account_name : '&nbsp;' ?></td>
            <td colspan="2"><?= $model->weldersdepot ?></td>
            <td colspan="2"><?= $model->stampno ?></td>
            <td colspan="2"><?= $model->weldprocess ?></td>
        </tr>


        <tr>
            <td colspan="2" class="DarkerBlue">Rail Profile L/H</td>
            <td colspan="2" class="DarkerBlue">Steel Grade L/H</td>
            <td colspan="2" class="DarkerBlue">Rail Wear L/H</td>
            <td colspan="2" class="DarkerBlue">Moulds Used</td>
            <td colspan="2" class="DarkerBlue">Portion No.</td>
            <td colspan="2" class="DarkerBlue">Batch No.</td>
        </tr>

        <tr>
            <td colspan="2"><?= $model->railprofilelh ? $model->railprofilelh : '&nbsp;' ?></td>
            <td colspan="2"><?= $model->steelgradelh ?></td>
            <td colspan="2"><?= $model->railwearlh ?></td>
            <td colspan="2"><?= $model->mouldused ?></td>
            <td colspan="2"><?= $model->portionno ?></td>
            <td colspan="2"><?= $model->batchno ?></td>
        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Rail Profile R/H </td>
            <td colspan="2" class="DarkerBlue">Steel Grade R/H </td>
            <td colspan="2" class="DarkerBlue">Rail Wear R/H </td>
            <td colspan="2" class="DarkerBlue">Wide Gap Batch No. </td>
            <td colspan="2" class="DarkerBlue">Wide Gap Portion No. </td>
            <td colspan="2" class="DarkerBlue">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2"><?= $model->railprofilerh ? $model->railprofilerh : '&nbsp;' ?></td>
            <td colspan="2"><?= $model->steelgraderh ?></td>
            <td colspan="2"><?= $model->railwearrh ?></td>
            <td colspan="2"><?= $model->widegapbatchno ?></td>
            <td colspan="2"><?= $model->widegapportionno ?></td>
            <td colspan="2">&nbsp;</td>
        </tr>

        <tr>
            <td colspan="12" style="padding:none;">
                <table class="table" style="border:none;">
                    <tr>
                        <td colspan="12">Running Table <?= $model->rtpf ?></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>-50cm</td>
                        <td>-37.5cm</td>
                        <td>-25cm</td>
                        <td>-12.5cm</td>
                        <td colspan='2'>WELD</td>
                        <td>12.5cm</td>
                        <td>25cm</td>
                        <td>37.5cm</td>
                        <td>50cm</td>
                        <td>&nbsp;</td>

                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td><?= $model->rt1 ?></td>
                        <td><?= $model->rt2 ?></td>
                        <td><?= $model->rt3 ?></td>
                        <td><?= $model->rt4 ?></td>
                        <td colspan="2"><?= $model->rt5 ?></td>
                        <td><?= $model->rt6 ?></td>
                        <td><?= $model->rt7 ?></td>
                        <td><?= $model->rt8 ?></td>
                        <td><?= $model->rt9 ?></td>
                        <td>&nbsp;</td>

                    </tr>
                    <tr>
                        <td colspan="12">Running Edge <?= $model->repf ?></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>-50cm</td>
                        <td>-37.5cm</td>
                        <td>-25cm</td>
                        <td>-12.5cm</td>
                        <td colspan='2'>WELD</td>
                        <td>12.5cm</td>
                        <td>25cm</td>
                        <td>37.5cm</td>
                        <td>50cm</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td width="5%">&nbsp;</td>
                        <td width="10%"><?= $model->re1 ?></td>
                        <td width="10%"><?= $model->re2 ?></td>
                        <td width="10%"><?= $model->re3 ?></td>
                        <td width="10%"><?= $model->re4 ?></td>
                        <td width="10%" colspan="2"><?= $model->re5 ?></td>
                        <td width="10%"><?= $model->re6 ?></td>
                        <td width="10%"><?= $model->re7 ?></td>
                        <td width="10%"><?= $model->re8 ?></td>
                        <td width="10%"><?= $model->re9 ?></td>
                        <td width="5%">&nbsp;</td>

                    </tr>
                </table>
            </td>
        </tr>

        <tr>
            <td colspan="4" class="DarkerBlue">Rejection Criteria</td>
            <td colspan="2" class="DarkerBlue">Result</td>
            <td colspan="4" class="DarkerBlue">Rejection Criteria</td>
            <td colspan="2" class="DarkerBlue">Result</td>
        </tr>
        <tr>
            <td colspan="4" class="DarkerBlue"></td>
            <td colspan="2" class="DarkerBlue">Pass/Fail</td>
            <td colspan="4" class="DarkerBlue"></td>
            <td colspan="2" class="DarkerBlue">Pass/Fail</td>
        </tr>
        <?php 
            $x = 1;
            $y= 22;
            ?>
        <?php while($x < 22){ ?>
        <?php 
                $fielda ='rc'.$x;
                $fieldb ='rc'.$y;
                $td = explode('||', $model->getAttributeLabel($fielda));
                $tdb = explode('||', $model->getAttributeLabel($fieldb));
            ?>
        <tr>
            <td colspan="1" width="10%"><?= $td[0]  ?></td>
            <td colspan="3" width="30%"><?= $td[1]  ?></td>
            <td colspan="2" width="10%"><?= $model->$fielda ?></td>
            <td colspan="1" width="10%"><?= $tdb[0]  ?></td>
            <td colspan="3" width="30%"><?= $tdb[1]  ?></td>
            <td colspan="2" width="10%"><?= $model->$fieldb ?></td>
        </tr>
        <?php $x++; $y++;?>
        <?php } ?>

        <tr>
            <td colspan="12" class=Title>Additional Information</td>
        </tr>
        <tr>
            <td colspan="3" class="DarkerBlue">Welds made at Lineside</td>
            <td colspan="3" class="DarkerBlue">Between tensors</td>
            <td colspan="3" class="DarkerBlue">Low ambient temp</td>
            <td colspan="3" class="DarkerBlue">Steel sleepers</td>
        </tr>
        <tr>
            <td colspan="3"><?= $model->weldsmadeatlineside ?> &nbsp;</td>
            <td colspan="3"><?= $model->betweentensors ?></td>
            <td colspan="3"><?= $model->lowambtemp ?></td>
            <td colspan="3"><?= $model->steelsleepers ?></td>

        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Welder Comments</td>
            <td colspan="10" style="height:70px;"><?= $model->welderscomments ?></td>
        </tr>
        <tr>
            <td colspan="3" class="DarkerBlue">Result</td>
            <td colspan="3"><?= $model->result ?></td>
            <td colspan="3" class="DarkerBlue">Action Required</td>
            <td colspan="3"><?= $model->actionrequired ?></td>
        </tr>
        <tr>
            <td colspan="3" class="DarkerBlue">UIC Code</td>
            <td colspan="3"><?= $model->uiccode ?></td>
            <td colspan="2"></td>
        </tr>
        <tr>
            <td colspan="2" class="DarkerBlue">Min Action Code</td>
            <td colspan="2"><?= $model->minactioncode ?></td>
            <td colspan="2" class="DarkerBlue">Removal Method</td>
            <td colspan="2"><?= $model->removalmethod ?></td>
            <td colspan="2" class="DarkerBlue">Removal Deadline</td>
            <td colspan="2" style="width: 150px;"><?= $model->removedeadline ?></td>
        </tr>
        <tr class="DarkerBlue">
            <td colspan="12">Inspector Comments</td>
        </tr>
        <tr>
            <td colspan="12" style="height:70px"><?= $model->inspectorcomments ?></td>
        </tr>
        <tr class="DarkerBlue">
            <td colspan="4">Date of Inspection</td>
            <td colspan="4">Inspectors I.D.</td>
            <td colspan="4">Signature</td>
        </tr>
        <tr>
            <td colspan="4"><?= $model->inspectiondate ?></td>
            <td colspan="4"><?= $model->insepectorid ?></td>
            <td colspan="4"><img height="75px" src="<?= $model->signatureloc ?>" /></td>
        </tr>
    </table>
    <div align="center">DT122 / <?= $model->id ?> / <?= $model->insepectorid ?></div>
</div>

<style>
.dt122-view td {
    padding: 2px 4px;
}
</style>