<link rel="stylesheet" href="<?php echo base_url();?>assets/js/validationEngine.jquery.css" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/cust_paginition.css" type="text/css" />
<div class="layout-app">
    <div class="container"><div class="row row-app">
            <div class="col-md-12">
                <div class="col-separator col-separator-first col-unscrollable bg-none">
                    <div class="col-table">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="widget">
                                    <?php $this->load->view('admin/flashdata_admin'); ?>

                                    <div class="widget-head">
                                        <a href="#addPromo" data-toggle="modal" class="btn btn-inverse pull-right mar" target="_blank" onclick="return add_promotion()"><i class="fa fa-fw fa-plus"></i>Add New</a>
                                        <h4 class="heading">Languages</h4>

                                    </div>
                                    <div class="clearfix"></div>

                                    <div class="widget-body">
                                        <div>
                                            <!-- <form action="" method="GET" >
                                                <div class="col-md-12 selectBox">
                                                    <div class="col-xs-4 col-md-2 bot-mar">
                                                        <label class="col-xs-12">From</label>
                                                        <input type="text" class="form-control date" name="from_date" value="<?php if ($arrGetData['from_date'] != "") echo date("m/d/Y", strtotime($arrGetData['from_date'])); ?>"/>
                                                    </div>
                                                    <div class="col-xs-4 col-md-2 bot-mar">
                                                        <label class="col-xs-12">To</label>
                                                        <input type="text" class="form-control date" name="to_date" value="<?php if ($arrGetData['to_date'] != "") echo date("m/d/Y", strtotime($arrGetData['to_date'])); ?>"/>
                                                    </div>

                                                    <div class="col-xs-4 col-md-2 bot-mar">
                                                        <label class="col-xs-12">Mode of Discount</label>
                                                        <select class="cust_select col-xs-12" name = "payment_mode">
                                                            <option value = "">--Select--</option>
                                                            <option value = "cash"
                                                                <?php if($_GET['payment_mode'] == 'cash') {?> selected
                                                                <?php } ?>>Cash</option>
                                                            <option value = "percentage" <?php if($_GET['payment_mode'] == 'percentage') {?> selected
                                                            <?php } ?>>Percentage</option>
                                                        </select>
                                                    </div>
                                                    <div class="col-xs-4 col-md-2 bot-mar">
                                                        <label class="col-xs-12">&nbsp;</label>
                                                        <div>
                                                            <button type="submit" class="btn btn-primary">Search</button>
                                                        </div>
                                                    </div>
                                            </form> -->
                                            <div class="clearfix"></div>
                                        </div>
                                    </div>
                                    <table class="table table-white table-vertical-center margin-none table-striped footable">
                                        <thead>
                                        <tr>
                                            <th data-class="highlight" class="text-center">Sr. No.</th>
                                            <th  class="text-center">Name</th>
                                            <th class="text-center">Edit</th>
                                            <!--<th class="text-center">Delete</th> -->
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <?php  if(count($arrData) > 0) {
                                            $intCounter = 1;
                                            foreach ($arrData as $data){
                                                ?>

                                                <tr>
                                                    <td class="text-center" ><?php echo $intCounter; ?></td>
                                                    <td class="text-center" ><?php echo ucwords($data['name']); ?></td>
                                                    <?php $strDecodedId = base64_encode($data['id']); ?>
                                                    <td class="text-center"><a href="#editPromo" data-toggle="modal" onclick="return edit_promotion('<?php echo $strDecodedId; ?>')"><i class="fa fa-pencil"></i></a></td>
                                                    <!--<td class="text-center">

                                                        <?php
                                                        //if (strtotime($arrPromo['end_date']) < strtotime(date("Y-m-d H:i:s"))) { ?>
                                                            <a href="<?php //echo base_url();?>index.php/promotion/delete_promotion/?promotion_id=<?php //echo base64_encode($arrPromo['id']); ?>" data-toggle="modal" onClick="return confirm('Are you sure to delete this promotion?');"><i class="fa fa-times"></i></a>
                                                        <?php //} ?>
                                                    </td> -->
                                                </tr>
                                            <?php  $intCounter++; }
                                        } else {?>
                                            <tr>
                                                <td class="text-center" colspan = "3">Sorry, No agent found !!</td>
                                            </tr>
                                        <?php } ?>
                                        </tbody>
                                    </table>
                                    <div class="text-center innerAll border-top pagination">
                                        <?php //echo $cust_Pagination; ?>
                                    </div>
                                </div>
                                <!-- // END TRENDS -->
                            </div>


                        </div>

                    </div>
                    <div class="col-separator-h"></div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<div class="modal fade" id="addPromo" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="tran_preview">

        </div>
    </div>
</div>
<div class="modal fade" id="editPromo" data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content" id="edit_promo">

        </div>
    </div>
</div>
<script src="<?php echo base_url(); ?>assets/library/jquery/jquery.min.js"></script>
<script src="<?php echo base_url();?>assets/js/custom.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>assets/plugins/forms_elements_multiselect/js/jquery.multi-select.js?v=v2.0.0-rc1&sv=v0.0.1.2"></script>
<script src="<?php echo base_url();?>assets/plugins/forms_elements_bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script src="<?php echo base_url();?>assets/components/forms_elements_bootstrap-select/bootstrap-select.js"></script>
<script src="<?php echo base_url();?>assets/components/forms_elements_bootstrap-select/bootstrap-select.init.js"></script>
<script src="<?php echo base_url();?>assets/components/forms_elements_fuelux-radio/fuelux-radio.init.js"></script>
<script src="<?php echo base_url();?>assets/components/forms_elements_multiselect/multiselect.init.js?v=v2.0.0-rc1&sv=v0.0.1.2"></script>
<script src="<?php echo base_url();?>assets/js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>assets/js/jquery.validationEngine.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/subscriber.js"></script>
<script type="application/javascript">
    function add_promotion()
    {
        $.ajax({
            url:"<?php echo base_url(); ?>index.php/language/add_lang",
            'type' : 'GET',
            success:function(result){
                $("#tran_preview").html(result);
                //alert(result);
            }
        });
    }

    function edit_promotion(intPromotionId)
    {
        $.ajax({
            url:"<?php echo base_url(); ?>index.php/language/edit_lang",
            'data' : {
                'lang_id' :intPromotionId
            },
            'type' : 'GET',
            success:function(result){
                $("#edit_promo").html(result);
            }
        });
    }


</script>