<?php

use common\widgets\DynamicInput;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<style>
    .sop023-view{
        @page: A4;
    }
    .sop023-view .sop023-page1 {
        display: none;
        page-orientation: Portrait;
        page-break-after: auto;
    }
    .sop023-view .sop023-page2 {
        page-orientation: Landscape;
        page-break-after: auto;
    }
</style>
<div class="sop023-view">
    <div class="buttons">
        <?= Html::Button('Save', ['class' => 'btn btn-success', 'onClick' => "$('.sop023-view form').submit()"]) ?>
    </div>
    <div class="sop023-page1">
        <h1>SOP023-Provision of Welfare Facilities for Operational Works:</h1>
        <h2>Purpose</h2>
        <p>
            The purpose of this procedure is to provide a structure by which welfare facilities will be assessed as to their suitability when undertaking works as a single contractor on assets that are outside of Network Rails control.   When working as a single Contractor or as a Contractor to a Principal Contractor for Network Rail, the provision of welfare facilities will be in line with NR/L2/OHS/CP0036
        </p>
        <h2>Scope</h2>
        <p>
            Inclusive of all operational works, suitable welfare facilities shall be provided and suitably maintained throughout the duration of the works and be available to all.
        Facilities shall include but may not be limited to:
        </p>
            <ul>
                <li>WCs</li>
                <li>Washing facilities</li>
                <li>Rest area</li>
                <li>Drying area</li>
            </ul>
        <h2>Assessing Requirements</h2>
        <p>
            As part of the planning for the works, the following factors will need to be established to determine the type of welfare facilities that are required.
        </p>
        <ul>
            <li>Duration of the works</li>
            <li>Numbers of personnel required each shift to deliver the works</li>
            <li>Location of the works and proximity to welfare facilities</li>
            <li>Type of worksite Non Transient & Transient</li>
        </ul>
        <p>
            <b>Non Transient</b> - is a term used to describe a site of work that has a fixed location and access to facilities are housed within a building on site, whether that be fixed or temporary construction.   
        </p>
        <p>
            <b>Transient</b> - is a term used to describe a site of work that is transient in nature and therefore facilities will be via a mobile facilities (welfare van) or local amenities.   
        </p>
    </div>
    <div class="sop023-page2">
        <?php $form = ActiveForm::begin(); ?>
            <table class="table table-bordered">
                <tr>
                    <th>
                        <?= $model->getAttributeLabel('jobno') ?>
                    </th>
                    <th>
                        <?= $model->getAttributeLabel('location') ?>
                    </th>
                    <th colspan="2">
                        <?= $model->getAttributeLabel('employees_on_site') ?>
                    </th>
                    <th>
                        <?= $model->getAttributeLabel('duration_of_works') ?>
                    </th>
                    <th>
                        <?= $model->getAttributeLabel('start_date') ?>
                    </th>
                    <th>
                        <?= $model->getAttributeLabel('finish_date') ?>
                    </th>
                    <th colspan="2">
                        <?= $model->getAttributeLabel('type_of_facilities') ?>
                    </th>
                </tr>
                <tr>
                    <td>
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'jobno', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'location', 'format' => false]); ?>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'employees_on_site', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'duration_of_works', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'start_date', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'finish_date', 'format' => false]); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'type_of_facilities', 'format' => false]); ?>
                    </td>
                </tr>
                <tr>
                    <th colspan="3" class="bg-light">
                        Table 1 - mixed gender (male & female) use or female only use
                    </th>
                    <th colspan="4" class="bg-light">
                        Table 2 -  single gender (male) staff
                    </th>
                    <th colspan="2" rowspan="2">
                        <?= $model->getAttributeLabel('separate_facilities_disabled'); ?>
                    </th>
                </tr>
                <tr>
                    <td>
                        <?= $model->getAttributeLabel('t1_people_at_work') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t1_no_of_toilets') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t1_no_of_washbasins') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t2_people_at_work') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t2_no_of_toilets') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t2_no_of_urinals') ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('t2_no_of_washbasins') ?>
                    </td>
                </tr>
                <?php $x = 0; ?>
                <?php while($x <= 2){ $x++; ?>
                    <tr>
                        <td rowspan="">
                            <?= $form->field($model, "t1_people_at_work$x")->checkbox(['label' => false, 'value' => $x, 'uncheck' => null])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t1_no_of_toilets$x")->dropdownList([0 => 'No', 1 => 'Yes'], ['prompt' => 'Please Select'])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t1_no_of_washbasins$x")->dropdownList([0 => 'No', 1 => 'Yes'], ['prompt' => 'Please Select'])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t2_people_at_work$x")->checkbox(['label' => false, 'value' => $x, 'uncheck' => null])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t2_no_of_toilets$x")->dropdownList([0 => 'No', 1 => 'Yes'], ['prompt' => 'Please Select'])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t2_no_of_urinals$x")->dropdownList([0 => 'No', 1 => 'Yes'], ['prompt' => 'Please Select'])->label(); ?>
                        </td>
                        <td rowspan="">
                            <?= $form->field($model, "t2_no_of_washbasins$x")->dropdownList([0 => 'No', 1 => 'Yes'], ['prompt' => 'Please Select'])->label(); ?>
                        </td>
                        <?php if($x == 1){ ?>
                            <td colspan="2" rowspan="2">
                                <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'separate_facilities_disabled', 'format' => false]); ?>
                            </td>
                        <?php }?>
                        <?php if($x == 3){ ?>
                            <td>
                               <?= DynamicInput::widget(['form' => $form, 'model' => $model,'name' => 'separate_facilities_disabled_no', 'format' => false]); ?>
                            </td>
                        <?php }?>
                    </tr>
                <?php }?>
                <tr>
                    <td colspan="9" class="bg-light">&nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <?= $model->getAttributeLabel('water_supply'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'water_supply', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('nutritional_facilities'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'nutritional_facilities', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('changing_facilities'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'changing_facilities', 'format' => false]); ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <?= $model->getAttributeLabel('break_locations'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'break_locations', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('temperature_control'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'temperature_control', 'format' => false]); ?>
                    </td>
                    <td>
                        <?= $model->getAttributeLabel('lockers'); ?>
                    </td>
                    <td colspan="2">
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'label' => false, 'name' => 'lockers', 'format' => false]); ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="9" >
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'name' => 'explanation', 'format' => false]); ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="9" >
                        <?= DynamicInput::widget(['form' => $form, 'model' => $model, 'name' => 'comments', 'format' => false]); ?>
                    </td>
                </tr>
            </table>
        <?php ActiveForm::end(); ?>
    </div>
</div>
