<?php
use yii\helpers\{Html, Url};
use yii\helpers\ArrayHelper;
/**
* @var yii\web\View $this 
* @var frontend\models\Activities $model 
* @var yii\widgets\ActiveForm $form 
*/
Yii::$app->params['buttons'] = [
    1 => [
        'label' => 'Add Activity',
        'title' => 'Add Activity',
        'url' => Url::to(['/activities/create']),
        'options' => [
            'class' => 'btn btn-success',
            'data-pjax' => 0,
        ],
        'icon' => 'plus',
        'visible' => Yii::$app->user->can('Activities.Create'),
    ],
];
?>

<div class="acttimeline">
    <div class="timeline">
        <div class="row">
            <div class="col-12 bg-darkerblue text-center mb-2 h1">
                Fatigue Management Plan
            </div>
        </div>
        <div class="d-flex justify-content-between flex-wrap">
            <div class="m-1 p-2 text-white Annualleave text-center flex-fill">Annual Leave</div>
            <div class="m-1 p-2 text-white Attended text-center flex-fill">Attended (<?= count($attended) ?>)</div>
            <div class="m-1 p-2 text-white Booked text-center flex-fill">Booked</div>
            <div class="m-1 p-2 text-white Completed text-center flex-fill">Completed (<?= count($completed) ?>)</div>
            <div class="m-1 p-2 text-white Invoiced text-center flex-fill">Invoiced (<?= count($invoiced) ?>)</div>
            <div class="m-1 p-2 text-white Lodge text-center flex-fill">Lodge</div>
            <div class="m-1 p-2 text-white Pre-booked text-center flex-fill">Pre-booked</div>
            <div class="m-1 p-2 text-white Rosteredoff text-center flex-fill">Rostered Off</div>
            <div class="m-1 p-2 text-white Sickness text-center flex-fill">Sickness</div>
            <div class="m-1 p-2 text-white Covid text-center flex-fill">Covid</div>
            <div class="m-1 p-2 text-white Training text-center flex-fill">Training</div>
            <div class="m-1 p-2 text-white NotAvailable text-center flex-fill">Not Available</div>
            <div class="m-1 p-2 text-white Travel text-center flex-fill">Travel</div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <?= \common\widgets\Timeline::widget([
                    'buttons' => [
                        1 => [
                            'enabled' => true,
                            'label' => 'Add Training',
                            'title' => 'Add training',
                            'url' => Url::to(['/activities/create-training']),
                            'options' => [
                                'class' => 'btn btn-success',
                                'data-pjax' => 0,
                            ],
                            'icon' => 'plus',
                            'visible' => Yii::$app->user->can('Activities.Create'),
                        ],
                        2 => [
                            'enabled' => true,
                            'label' => 'Add Welding',
                            'title' => 'Add welding',
                            'url' => Url::to(['/activities/create']),
                            'options' => [
                                'class' => 'btn btn-success',
                                'data-pjax' => 0,
                            ],
                            'icon' => 'plus',
                            'visible' => Yii::$app->user->can('Activities.Create'),
                        ],
                    ],
                    'dates' => [
                        'startDate' => $sdate,
                        'endDate' => null,
                    ],
                    'pluginOptions' => [
                        'containerName' => 'visualization',
                    ],
                    'id' => 'visualization',
                    'data' => [
                        'groups' => $groups,
                        'data' => null,
                        'items' => $data,
                    ],
                    'modal' => [
                        'url' => Url::to(['/activities/timeline-modal'])
                    ],
                    'display' => [
                        'number' => 2,
                        'duration' => 'weeks',
                    ]
                ]); ?>
            </div>
        </div>
    </div>
</div>