<?php defined('BASEPATH') OR exit('No direct script access allowed');
?>
<main>
    <div class="container">
        <div class="row">
            <div class="col s2"><a href="#modal_create_timekeeper"
                                   class="modal-trigger btn-floating btn-large waves-effect waves-light tooltipped indigo"
                                   data-position="right" data-delay="50"
                                   data-tooltip="<?php echo $timekeeper_text['timekeeper_create'] ?>"><i
                            class="material-icons">add</i></a>
            </div>

        </div>
        <div class="">
            <span style="font-weight: bold"> <?php echo $timekeeper_text['timekeeper_text'] ?></span>
        </div>
        <div class="row">
            <?php $count = 0; ?>
            <ul class="collapsible popout " data-collapsible="expandable">

                <?php foreach ($timekeeper as $tk) { ?>

                    <li>
                        <div class="collapsible-header <?php echo $count % 2 == 0 ? 'grey lighten-2' : null; ?>  ">
                            <i class="material-icons">expand_more</i></i>
                            <table class="responsive-table">
                                <thead>
                                <tr>
                                    <th> <?php echo $timekeeper_text['timekeeper_name'] ?></th>
                                    <th> <?php echo $timekeeper_text['timekeeper_surname'] ?></th>
                                    <th> <?php echo $timekeeper_text['timekeeper_surname2'] ?></th>
                                    <th> <?php echo $timekeeper_text['timekeeper_dni'] ?> </th>
                                    <th> <?php echo $timekeeper_text['timekeeper_email'] ?> </th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td> <?php echo $tk -> nombre == null ? '-' : $tk ->nombre?></td>
                                    <td> <?php echo $tk -> apellido1 == null ? '-' : $tk ->apellido1?></td>
                                    <td> <?php echo $tk -> apellido2 == null ? '-' : $tk ->apellido2?></td>
                                    <td> <?php echo $tk -> dni == null ? '-' : $tk ->dni?></td>
                                    <td> <?php echo $tk -> email == null ? '-' : $tk ->email?></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="collapsible-body row">
                            <div class="col s12 xl4 offset-xl8">
                                <form >
                                    <button class="btn btn-large waves-effect indigo" onclick="return update_timekeeper_password('<?php echo $tk -> email?>')"><?php echo $timekeeper_text['timekeeper_change_password'] ?></button>
                                </form>

                            </div>

                            <div class="col xl3 offset-xl8">

                            </div>


                        </div>
                    </li>
                    <?php $count++;
                } ?>
            </ul>

        </div>
    </div>
    </main>

<body>




<!-- Modal Structure -->
<div id="modal_create_timekeeper" class="modal z-depth-5">
    <form method="post" action="<?php echo base_url() ?>timekeeper/create">
        <div class="modal-content">
            <div class="row">
                <div class="col s12 xl12">
                    <span style="font-weight: bold"><?php echo $timekeeper_text['timekeeper_form_text']?></span>
                </div>
            </div>
            <div class="row">
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="email" name="email" required maxlength="30" data-length="30"/>
                    <label for="email"> <?php echo $timekeeper_text['timekeeper_email']?>(*)</label>
                </div>
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="text" name="dni" required maxlength="9" data-length="9"/>
                    <label for="email"> <?php echo $timekeeper_text['timekeeper_dni']?>(*)</label>
                </div>
            </div>
            <div class="row">
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="text" name="name" required maxlength="30" data-length="30"/>
                    <label for="name"><?php echo $timekeeper_text['timekeeper_name']?>(*)</label>
                </div>
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="text" name="surname" required maxlength="30" data-length="30"/>
                    <label for="surname"> <?php echo $timekeeper_text['timekeeper_surname']?> (*)</label>
                </div>
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="text" name="surname2" maxlength="30" data-length="30"/>
                    <label for="surname2"> <?php echo $timekeeper_text['timekeeper_surname2']?> </label>
                </div>
            </div>
            <div class="row">
                <span style="font-weight: bold"> <?php echo $timekeeper_text['timekeeper_form_create_password'];?></span>
                <div class="col s12 xl6 offset-xl2 input-field">
                    <i class="material-icons prefix">create</i>
                    <input type="password" name="password" required maxlength="30" data-length="30"/>
                    <label for="email"> <?php echo $timekeeper_text['timekeeper_form_password']?>(*)</label>
                </div>

            </div>

        </div>
        <div class="modal-footer">
            <button class="btn btn-large waves-effect indigo"><?php echo $timekeeper_text['timekeeper_form_create_timekeeper'] ?></button>
        </div>
    </form>
</div>
<div id="update_passwd_timekeeper" class="modal">
    <div class="modal-content">
        <div class="container">
            <div class="row">
                <div class="col s12 xl6 offset-xl3">
                    <span style="font-weight: bold"><?php echo $timekeeper_text['timekeeper_change_password_text']?></span>
                </div>
            </div>
            <div class="row">
                <form action="<?php echo base_url()?>timekeeper/changePassword" method="post">
                    <div class="col s12 xl6 offset-xl3 input-field">
                        <input class="validate" type="password" name="password"
                                value="" required/>
                        <label for="email"><?php echo $timekeeper_text['timekeeper_change_password_new']?></label>
                        <input type="hidden" id="timekeeperid" value="" name="email">
                    </div>
                    <div class="col s12 xl6 offset-xl3 input-field">
                        <button class="btn btn-large waves-effect indigo"><?php echo $timekeeper_text['timekeeper_change_password_btn']?></button>
                    </div>
                </form>
            </div>
        </div>

    </div>

</div>

</body>


