<?php

use yii\helpers\Html;
use yii\helpers\Url;
use app\components\Utilities;

$this->title = $form_name . ' unverified records';

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

$base_url = json_encode(Url::base(true));

$script =<<< JS
    $(document).ready(function(){
        initDatatable(
            $columns_names,
            $base_url + '/offline-data-verification/verify-form-records-data?form_id=' + $form_id + '&version=' + $version
        );
    });
JS;

$this->registerJs($script);

?>

<div class="forms-index">

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

    <?php if(count($columns_labels) == Utilities::getSubmissionsFieldsSelectionCount()): ?>
        <div class="alert alert-info">
            <?= Yii::t('app', 'Only the first ' . count($columns_labels) . ' fields of form are shown (according to admin settings)') ?>
        </div>
    <?php endif; ?>

    <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>