<?php echo $this->extend('template/admin/main') ?>

<?php echo $this->section('content') ?>
    <?php echo $this->include('common/message') ?>

    <div class="card mb-4">
        <div class="card-body">

            <?php if ($add_data == true && false) : ?>
                <div class="text-end">
                    <a class="btn btn-success" href="<?php echo base_url(route_to('new-employeetype')) ?>"><?php echo lang("Localize.add_employee_type") ?></a>
                </div>
            <?php endif ?>

            <div class="table-responsive">
                <table class="table display table-bordered table-striped table-hover basic" id="employeetype">
                    <thead>
                        <tr>
                            <th scope="col">#</th>
                            <th scope="col"><?php echo lang("Localize.type") ?></th>
                            <th scope="col"><?php echo lang("Localize.details") ?></th>
                            <?php if ($edit_data == true && (session()->get('role_id') == 1)) : ?>
                                <th scope="col"><?php echo lang("Localize.action") ?></th>
                            <?php endif ?>
                        </tr>
                    </thead>
                    <tbody>

                        <?php foreach ($employeetype as $kye =>  $value) : ?>
                            <tr>
                                <th scope="row"><?php echo $kye + 1; ?></th>
                                <td><?php echo $value->type; ?></td>
                                <td><?php echo $value->detail; ?></td>
                                <?php if ($edit_data == true && (session()->get('role_id') == 1)) : ?>
                                <td>
                                    <form action="<?php echo base_url(route_to('delete-employeetype', $value->id)) ?>" id="employeetypedel" method="post" class="" accept-charset="utf-8" enctype="multipart/form-data">
                                        <?php echo $this->include('common/delete') ?>

                                        <?php if ($edit_data == true && (session()->get('role_id') == 1)) : ?>
                                            <a href="<?= base_url(route_to('edit-employeetype', $value->id)) ?>" class="btn btn-sm btn-info text-white" title="<?php echo lang("Localize.edit") ?>"><i class="fas fa-edit"></i></a>
                                        <?php endif ?>

                                        <?php if ($delete_data == true && false) : ?>
                                            <?php if (($value->id != 1) &&  ($value->id != 2)) : ?>
                                                <button type="submit" class="btn btn-sm btn-danger" title="<?php echo lang("Localize.delete") ?>"><i class="far fa-trash-alt"></i></button>
                                            <?php endif ?>
                                        <?php endif ?>
                                    </form>
                                </td>
                                <?php endif ?>
                            </tr>
                        <?php endforeach ?>

                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <?php echo $this->include('common/datatable_default_lang_change') ?>
<?php echo $this->endSection() ?>