<?php

use yii\helpers\Html;
use yii\helpers\Url;

$this->title = $model->name . ' (all collected data)';

$this->registerCssFile(\app\components\Utilities::getDataTableCssFileLink());

$base_url = json_encode(Url::base(true));
$form_id = json_encode((string)$model->formId);
$campaign_id = json_encode((string)$model->_id);

$script =<<< JS
    $(document).ready(function(){
        initDatatable(
            $columns_names,
            $base_url + '/campaigns/get-collected-data-records?campaign_id=' + $campaign_id
        );
    });
JS;

$this->registerJs($script);

?>

<div class="forms-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <div class='table-responsive'>
        
        <table class='cell-border stripe' id='data-table'>
            <thead>
                <td></td>   <!-- View page link -->
                <?php foreach($columns_labels as $column): ?>
                    <td><?= ucfirst($column) ?></td>
                <?php endforeach; ?>
            </thead>
            
            <tfoot>
                <tr>
                    <th></th>   <!-- View page link -->
                </tr>
            </tfoot>
        </table>

    </div>

</div>