<?php

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

$this->title = 'Child Records';

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

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

$script =<<< JS
    $(document).ready(function(){
        initDatatable(
            $columns_names,
            $base_url + '/forms/view-all-child-records-data?form_id=' + $form_id + '&field_name=' + $field_name + '&value=' + $value + '&parent_form_id=' + $parent_form_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>