<?php
    require_once(LIBRARY_PATH . "/utilsFunctions.php");
?>

<!-- Homepage content -->
<div class="row">
    <h1>Renkans</h1>
</div>

<div class="row">
    <h3>Create new Renkan</h3>
</div>
<div class="row">
    <form action='renkan_edit.php' method='POST'>
    <div class="row">
        <div class="large-8 columns">
          <div class="row collapse">
            <div class="small-10 columns">
              <input type="text" placeholder="title" name='title'/>
            </div>
            <div class="small-2 columns">
              <button type='submit' class="button postfix">Create</button>
            </div>
          </div>
        </div>
    </div>
    </form>
</div>

<div id="renkanlist">
    <div class="row">
        <h3>Renkan list</h3>
    </div>
    <div class="row" >
        <table role='grid' id="renkanlist-table">
            <thead>
            <tr>
                <th id="renkanlist-title-header">Title</th>
                <th id="renkanlist-actions-header">actions</th>
            </tr>
            </thead>
            <tbody>
        <?php
            foreach($renkans as $renkan) {
                echo("<tr>");
                echo("    <td><a href='renkan_read.php?renkanId=$renkan[id]'>$renkan[title]</a></td>");
                echo("    <td class='renkanlist-actions'><a href='renkan_edit.php?renkanId=$renkan[id]'><span class='fi-pencil has-tip' data-tooltip aria-haspopup='true' title='edit'></span></a>");
                echo("        <a href='renkan_read.php?renkanId=$renkan[id]'><span class='fi-eye has-tip' data-tooltip aria-haspopup='true' title='view'></span></a>");
                echo("        <a href='renkan_del.php?renkanId=$renkan[id]'><span class='fi-trash has-tip' data-tooltip aria-haspopup='true' title='delete'></span></a></td>");
                echo("</tr>");
            }
        ?>
            </tbody>
        </table>
    </div>
</div>
