<?php
$template = json_decode(file_get_contents(resource_path('views/app/dq-templates/' . $template)));
$loadedData = $data;
if(!$loadedData || !@$loadedData->lines || !@$loadedData->dataMap) {
    $loadedData = $template;
}
if(!function_exists('_renderDQLine')) {
    function _renderDQLine($_line, $loadedData) {
        if (!!@$loadedData->dataMap->{$_line->key}) {
            $result = str_replace('{value}', $loadedData->dataMap->{$_line->key}, $_line->resultSummary);
            echo '<span class="mr-2 text-nowrap">• ' . $result . '</span>';
            if (@$_line->lines) {
                foreach ($_line->lines as $line) {
                    _renderDQLine($line, $loadedData);
                }
            }
        }
    }
}
?>
<div class="dq-read-container">
    @foreach ($loadedData->lines as $line)
        <?php _renderDQLine($line, $loadedData); ?>
    @endforeach
</div>