<?php

use Proud\Document;
$icon = Document\get_document_icon();
$title = $icon == 'fa-globe' ? 'title="Complete this form online"' : 'title="View/download form"';
?>

<div <?php 
post_class("teaser");
?>
>
  <div class="row">
    
    <div class="col-xs-2 col-md-1">
      <a href="<?php 
echo esc_url(get_permalink());
?>
" <?php 
echo $title;
?>
>
        <i class="fa fa-3x text-muted filetype-icon <?php 
echo $icon;
?>
"></i>
      </a>
    </div>
    <div class="col-md-7">
      <h4 class="entry-title" style="margin-top:0;">
        <?php 
the_title(sprintf('<a href="%s" rel="bookmark" %s>', esc_url(get_permalink()), $title), '</a>');
$show_preview = in_array($filetype, array('pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx')) && (strpos(strtoupper($meta->size), 'KB') !== FALSE || strpos($meta->size, 'MB') !== FALSE && (int) str_replace(' MB', '', $meta->size) < 10);
// @todo: currently not showing gravity forms
/*
$form_id = get_post_meta( $id, 'form', true );
if ( !empty($form_id) ) {

  // Docs: https://www.gravityhelp.com/documentation/article/embedding-a-form/#usage-examples
  // gravity_form( $id_or_title, $display_title = true, $display_description = true, $display_inactive = false, $field_values = null, $ajax = false, $tabindex, $echo = true );
  $form = gravity_form( $form_id, false, true, false, null, false, 0, false );
  $show_preview = 2;
}*/
?>

<h2 style="max-width:600px;">
  <i class="fa fa-fw <?php 
echo Document\get_document_icon($id);
?>
"></i>
  <a href="<?php 
echo $src;
?>
" class="btn btn-primary btn-sm pull-right" download="<?php 
echo $filename;
?>
"><i class="fa fa-download"></i> Download</a>
  <a href="<?php 
echo get_permalink($id);
?>
"><?php 
echo get_the_title($id);
?>
    // Docs: https://www.gravityhelp.com/documentation/article/embedding-a-form/#usage-examples
    // gravity_form( $id_or_title, $display_title = true, $display_description = true, $display_inactive = false, $field_values = null, $ajax = false, $tabindex, $echo = true );
    $form = gravity_form($form_id, false, true, false, null, false, 0, false);
    $show_preview = 2;
}
?>
<div class="page-header">
  <h2><a href="/documents" onclick="history.go(-1);return false;"><?php 
echo __('Documents and forms');
?>
</a></h2>
</div>

<h1 class="entry-title">
  <i class="fa fa-fw <?php 
echo Document\get_document_icon();
?>
"></i>
  <?php 
the_title();
?>
</h1>

<div class="row">
  <div class="col-md-3">
    <!--<p><img src="<?php 
echo $meta->icon;
?>
" /></p>-->
    <p>
      <?php