<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

use common\widgets\TinyMce;

use common\models\Users;
/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dtccrc */
/* @var $form yii\widgets\ActiveForm */
if (!$model->actid) {$model->actid = Yii::$app->getRequest()->getQueryParam('actid');}
if (!$model->location) {$model->location = Yii::$app->getRequest()->getQueryParam('location');}
if (!$model->name) {$model->name = Yii::$app->user->identity->username;}
if (!$model->date) {$model->date = date('d/m/Y', strtotime('today'));} else {
	$model->date = date('d/m/Y', strtotime($model->date));
}
if (!$model->time) {$model->time = date('H:i', strtotime('now'));} else {
	$model->time = date('H:i', strtotime($model->time));
}

$this->registerJsFile('/js/touch.js'); //load canvas drawing 
$this->registerJsFile('/js/touch_0.js');//load canvas_0
//$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 

?>
<script>
window.onload = function() {
    //init(); //Drawing
    init0(); //canvas_0
    //init1(); //canvas_1
    //init2(); //canvas_2
    //init3(); //canvas_3
}
</script>


<div class="dtccrc-form col-sm-12">

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

    <div class="row DarkerBlue">
        <div class="col-am-12" align="center">
            <img src="/images/logo.jpg" alt="logo"></img>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <div class="pull left"><img height="75px" width="auto" s src="/images/homesafe.jpg" alt="homesafe"></img>
            </div>
            <div class="pull right"><img height="75px" width="auto" src="/images/homesafe.jpg" alt="homesafe"></img>
            </div>
            <div align="center">Close Call <br />Reporting Card</div>
        </div>

    </div>


    <div class="row">
        <div class="col-md-12 DarkerBlue">Company Contact Numbers:</div>
        <div class="col-md-6">
            Planning: 07985 235 382<br />
            Engineer: 07909 685 831<br />
            Operations HQ: 01622 854 730 <br />
            HSEQ: 07983 174 286
        </div>
    </div>
    <div class="row DarkerBlue">
        <div class="col-md-4">Company Email Address</div>
        <div class="col-md-8"><a href="mailto:info@inlinetrack.co.uk">info@inlinetrack.co.uk</a></div>
    </div>

    <div class="row">
        <div class="col-md-4 DarkerBlue">Recognise - Respond - Report</div>
        <div class="col-md-4 text-danger h3">Close Call Card</div>
        <div class="col-md-4 DarkerBlue">&nbsp;</div>
    </div>


    <div class="row DarkerBlue">
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-4">Name</div>
                <div class="col-md-8"><?= $form->field($model, 'name')->textInput()->label(false) ?></div>
            </div>
            <div class="row">
                <div class="col-md-4">Date</div>
                <div class="col-md-8"><?= $form->field($model, 'date')->textInput()->label(false) ?></div>
            </div>

        </div>
        <div class="col-md-6">
            <div class="row">
                <div class="col-md-4">Location</div>
                <div class="col-md-8"><?= $form->field($model, 'location')->textInput()->label(false) ?></div>
            </div>
            <div class="row">
                <div class="col-md-4">Time</div>
                <div class="col-md-8"><?= $form->field($model, 'time')->textInput()->label(false) ?></div>
            </div>

        </div>
    </div>
    <div class="row DarkerBlue">
        <div class="col-md-2">Saftey</div>
        <div class="col-md-2">Environmental</div>
        <div class="col-md-2">Quality</div>
        <div class="col-md-2">Health</div>
        <div class="col-md-2">Welfare</div>
    </div>

    <div class="row">
        <div class="col-md-12 DarkerBlue">
            Close Call/Hazard/Concern
        </div>
        <div class="col-md-12">
            <?= $form->field($model, 'type')->textInput()->label(false) ?>
        </div>
        <div class="col-md-12 DarkerBlue">
            Please describe what could have happened:
        </div>
        <div class="col-md-12">
            <?= $form->field($model, 'description')->widget(TinyMce::class, [])->label(false); ?>
        </div>
        <div class="col-md-12 DarkerBlue">
            Action Taken to Fix Problem? YES/NO Give Deatials:
        </div>
        <div class="col-md-12">
            <?= $form->field($model, 'action')->widget(TinyMce::class, [])->label(false); ?>
        </div>

        <div class="col-4 Darkerblue">
            Where were you?
        </div>
        <div class="col-8">
            <?= $form->field($model, 'issuelocation')->Dropdownlist(['Access Point'=>'Access Point','Construction Site'=>'Construction Site','Depot'=>'Depot','Lineside'=>'Lineside','On-Track (4 foot)'=>'On-Track (4 foot)','Office Facilities'=>'Office Facilities','Public Area'=>'Public Area','Highway Areas'=>'Highway Areas','Site Offices'=>'Site Offices','Stations'=>'Stations'])->label(false) ?>
        </div>
    </div>

    <?= $form->field($model, 'issuetype')->hiddenInput()->label(false) ?>

    <?= $form->field($model, 'engineersign')->hiddenInput()->label(false) ?>

    <?= $form->field($model, 'clientsign')->hiddenInput()->label(false) ?>
    <?= $form->field($model, 'actid')->hiddenInput()->label(false) ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
    </div>

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

</div>