<?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_cancellation == true) : ?>
                <div class="text-end">
                    
                    <?php if (true && false) : ?>
                        <?php if (!isset($trash_view)) : ?>
                            <a class="btn btn-warning me-1" href="<?php echo base_url(route_to('trash-index-company')) ?>">
                                <i class="fas fa-trash-restore"></i>
                                <?php echo lang("Localize.view_deleted") ?>
                            </a>
                        <?php else : ?>
                            <a class="btn btn-info me-1" href="<?php echo base_url(route_to('index-company')) ?>">
                                <i class="fas fa-list"></i>
                                <?php echo lang("Localize.view_all") ?>
                            </a>
                        <?php endif; ?>
                    <?php endif; ?>

                    <a class="btn btn-success mb-3" href="<?php echo base_url(route_to('new-cancellation')) ?>"><i class="fas fa-user-plus"></i> <?php echo lang("Localize.add_cancellation_policy") ?></a>
                        </br>
                </div>
            <?php endif ?>

            <div class="table-responsive">
                <table class="table display table-bordered table-striped table-hover basic" id="companylist">
                    <thead>
                        <tr>
                            <th scope="col">#</th>
                            <th scope="col"><?php echo lang("Localize.company_name") ?></th>
                            <?php if ($role_id == 1) : ?>
                                <th scope="col"><?php echo lang("Localize.action") ?></th>
                            <?php endif ?>
                        </tr>
                    </thead>
                    <tbody>
                       

                        <?php foreach ($cancellationlist as $kye => $cancellationvalue) : ?>

                            <tr>
                                <th scope="row"><?php echo $kye + 1; ?></th>
                                <td>
                                    <a href="<?php echo base_url(route_to('edit-company', $cancellationvalue->company_id)) ?>">
                                        <?php echo $cancellationvalue->company_name; ?>
                                    </a>
                                </td>

                                <?php if ($role_id == 1) : ?>
                                    <td>
                                        <?php if ($cancellationvalue->deleted_at == null) :  ?>

                                            <?php if ($edit_cancellation == true) : ?>
                                                <a href="<?php echo base_url(route_to('edit-cancellation', $cancellationvalue->company_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_cancellation == true) : ?>
                                                <!-- <form action="<?php echo base_url(route_to('ss-delete-confirmation', 'cancellation', $cancellationvalue->company_id)) ?>" class="d-inline-block deletionForm" method="get">
                                                    <button role="button" data-modal-confirm="true" class="btn btn-sm btn-danger text-white" title="<?php echo lang("Localize.delete") ?>">
                                                        <i class="fas fa-trash"></i>
                                                    </button>
                                                </form> -->
                                            <?php endif ?>

                                        <?php else : ?>

                                            <?php if ($delete_cancellation == true) : ?>
                                                <!-- <a href="<?php echo base_url(route_to('restore-cancellation', $cancellationvalue->id)) ?>" class="btn btn-sm btn-success text-white" title="<?php echo lang("Localize.restore") ?>">
                                                    <i class="fas fa-undo-alt"></i>
                                                    <?php echo lang("Localize.restore"); ?>
                                                </a> -->
                                            <?php endif; ?>

                                        <?php endif; ?>
                                    </td>
                                <?php endif ?>
                            </tr>
                        <?php endforeach ?>


                    </tbody>
                </table>
            </div>

        </div>
    </div>
    <?php echo $this->include('common/datatable_default_lang_change') ?>
    <?php echo $this->include('common/confirmation-modal') ?>
    
    <!--model for wallet-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
</div>

<script>
    function waletRec(id,bal){
        $("#hdnid").val(id);
        $("#balSpan").html(bal);
        $("#exampleModal").modal("show");
    }

    function modelClose(){
        $("#exampleModal").modal("hide");
    }
</script>
    <!--model end-->
<?php echo $this->endSection() ?>