<?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_company == 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" href="<?php echo base_url(route_to('new-company')) ?>"><i class="fas fa-user-plus"></i> <?php echo lang("Localize.add_company") ?></a>
                </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">#123</th>
                            <th scope="col"><?php echo lang("Localize.name") ?></th>
                            <th scope="col"><?php echo lang("Localize.email") ?></th>
                            <th scope="col"><?php echo lang("Localize.mobile") ?></th>
                            <th scope="col"><?php echo lang("Localize.status") ?></th>
                            <th scope="col"><?php echo lang("Localize.sourceOption") ?><?php echo "ssss";?></th>
                            <?php if ($role_id == 1) : ?>
                                <th scope="col"><?php echo lang("Localize.action") ?></th>
                            <?php endif ?>
                        </tr>
                    </thead>
                    <tbody>
                       

                        <?php foreach ($companydetail as $kye => $companyvalue) : ?>

                            <tr>
                                <th scope="row"><?php echo $kye + 1; ?></th>
                                <td>
                                    <a href="<?php echo base_url(route_to('transaction-company', $companyvalue->id)) ?>">
                                        <?php echo $companyvalue->name; ?>
                                    </a>
                                </td>
                                <td><?php echo $companyvalue->login_email; ?></td>
                                <td><?php echo $companyvalue->login_mobile; ?></td>
                                <td>
                                    <?php if ($companyvalue->status == 1) : ?>
                                        <span class="badge bg-success"><?php echo lang("Localize.publish") ?></span>
                                    <?php endif ?>
                                    <?php if ($companyvalue->status == 0) : ?>
                                        <span class="badge bg-secondary"><?php echo lang("Localize.unpublish") ?></span>
                                    <?php endif ?>
                                </td>
                                <td><?php echo $sourceOptions[$companyvalue->source_option]; ?></td>
                                <?php if ($role_id == 1) : ?>
                                    <td>
                                        <?php if ($companyvalue->deleted_at == null) :  ?>

                                            <?php if ($edit_company == true) : ?>
                                                <form action="<?php echo base_url(route_to('status-company', $companyvalue->id)) ?>" class="d-inline-block" method="post">
                                                    <?php echo $this->include('common/securityupdate'); ?>

                                                    <button type="submit" class="btn btn-sm btn-secondary text-white" title="<?php echo lang("Localize.status") ?>">
                                                        <i class="<?php echo 'fa fa-user-' . (!$companyvalue->status ? 'check' : 'slash') ?>"></i>
                                                    </button>
                                                </form>
                                            <?php endif ?>


                                            <?php if ($edit_company == true) : ?>
                                                <a href="<?php echo base_url(route_to('edit-company', $companyvalue->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_company == true) : ?>
                                                <form action="<?php echo base_url(route_to('ss-delete-confirmation', 'company', $companyvalue->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_company == true) : ?>
                                                <a href="<?php echo base_url(route_to('restore-company', $companyvalue->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() ?>