<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php
            $this->load->view('user/common_style');
        ?>
        <link rel="stylesheet" href="<?php echo base_url();?>styles/fonts/Socialico/stylesheet.css">
        <link rel="stylesheet" href="<?php echo base_url();?>styles/css/set1.css">
        <script src="<?php echo base_url();?>styles/js/modernizr.js"></script>
        <style>
            .contact_one .contact_left_content form input[type="text"]{border:0px;}
            /*.prfledit label, .prfledit label {
                padding-top: 10px;
            }*/
            .prfledit select {
                margin: 0;
            }
            .help-block {
                color: #eb5055;
                margin: 0em 0em 0em !important;
            }
            /*.profilesub ul li label{
                display: inline;
                color: #eb5055;
            }*/
            /*.help-block {
                color: #eb5055;
                margin: 0em 0em 0em !important;
            }
            p.frgtpwd {
                text-transform: none;
            }*/
        </style>
    </head>
    <body>
        <div id="preloader">
            <div class="preloader_spinner"> </div>
        </div>

        <section class="body_wrapper home_one">
         
           <?php
                $this->load->view('user/header');
                $this->load->view('user/login_header');
            ?>

            <section class="dmain">
              <div class="container">
                <h2 class="section_hedings1"><?php echo $this->lang->line('lbl_fundtransfer_page_title'); ?></h2><br>
              </div>
            </section>
  
            <section class="dmain" style="padding:0;">
                <div class="container">
                    <?php $currency_info = defaultcurrency();?>

                    <form class="fundtransfer" method="post" action="<?php echo base_url();?>transfer">
                        <div class="row">
                            
                            <div class="col-lg-9"> 
                            <?php if($transfer_status == 'on') {?>
                                <div class="gry">
                                    <div class="profilesub clearfix profilesub2">

                                            <?php if($this->session->flashdata('success_message')) {?>

                                                <div class="row">
                                                    <div class="col-lg-12 ">
                                                        <p class="frgtpwd frgtpwd1">
                                                            <i class="fa fa-thumbs-up"></i><?php echo $this->session->flashdata('success_message');?>
                                                        </p>
                                                    </div>
                                                </div>

                                            <?php } elseif ($this->session->flashdata('error_message')) { ?>

                                                <div class="row">
                                                    <div class="col-lg-12">
                                                        <p class="frgtpwd frgtpwd1 frgtpwdred">
                                                            <i class="fa fa-thumbs-down"></i><?php echo $this->session->flashdata('error_message');?>
                                                        </p>
                                                    </div>
                                                </div>

                                            <?php } ?>


                                            <ul class="prfledit">
                                                <div class="col-lg-12">

                                                    <!-- <li class="form-group <?php if(form_error('payment')) echo "has-error";?>">
                                                        
                                                        <p class="control-label col-lg-4 text-semibold"><?php echo $this->lang->line('fund_transfer_payment'); ?> <label class="text-danger">*</label></p>
                                                        <div class="col-lg-2"><p>:</p></div>
                                                        <div class="col-lg-6">
                                                            <div>
                                                                <select name="payment"  id="payment_check" class="">
                                                                    <option value=""><?php echo $this->lang->line('none_selected'); ?></option>
                                                                    <?php foreach ($payment_list as $list) { ?>
                                                                    <option <?php echo set_select('payment');?> value="<?php echo $list->payment_id; ?>"><?php echo ucfirst($list->payment_name); ?></option>
                                                                    <?php } ?>
                                                                </select>
                                                            </div>
                                                            <div class="messageContainer"></div>
                                                            
                                                            <?php echo form_error('payment', '<span class="help-block">', '</span>'); ?>
                                                        </div>
                                                        <span style="display:none;" id="select_gateway_id"></span>
                                                    </li> -->

                                                    <li class="form-group <?php if(form_error('receiver')) echo "has-error";?>">
                                                        
                                                        <p class="control-label col-lg-4 text-semibold"><?php echo $this->lang->line('lbl_fund_transfer_receiver'); ?> <label class="text-danger">*</label></p>
                                                        <div class="col-lg-2"><p>:</p></div>
                                                        <div class="col-lg-6">
                                                            <div class="">
                                                                <input type="text" name="receiver" value="<?php echo set_value('receiver');?>">
                                                            </div>
                                                            <div class="messageContainer"></div>
                                                            <?php echo form_error('receiver', '<span class="help-block">', '</span>'); ?>
                                                        </div>
                                                        
                                                    </li>

                                                    <li>
                                                        <div class="form-group">
                                                            <p class="control-label col-lg-4 text-semibold"><?php echo $this->lang->line('fund_transfer_balance'); ?></p>
                                                            <div class="col-lg-2"><p>:</p></div>
                                                            <div class="col-lg-6">
                                                                <label style="margin-top: 5px;border:none;" ><label id="balanceVal"><?php echo number_format('0',$currency_info->deimal_point, '.', ''); ?></label>&nbsp<label id="deduct"><?php echo strtoupper($currency_info->currency_unit);?></label></label>
                                                                <div id="ip-exist" style="display:none;color:#d84315;" class="error_msg"><?php echo $this->lang->line('fund_balance'); ?></div>
                                                            </div>
                                                        </div>
                                                    </li>

                                                    <li class="form-group <?php if(form_error('amount')) echo "has-error";?>">
                                                        
                                                        <p class="control-label col-lg-4 text-semibold"><?php echo $this->lang->line('fund_transfer_amount'); ?> <label class="text-danger">*</label></p>
                                                        <div class="col-lg-2"><p>:</p></div>
                                                        <div class="col-lg-6">
                                                            <div class="">
                                                                <div class="">
                                                                    <!-- <span style="font-size: 18px; background: none; border: medium none; line-height: 39px;"  class="col-xs-2 input-group-addon"><strong><?php echo $currency_info->currency_symbol;?></strong></span> -->
                                                                    <label style="padding: 5px 0px; width: 5%; line-height: 40px;" class="col-lg-2"><strong><?php echo $currency_info->currency_symbol;?></strong></label>
                                                                    <input type="text" value="" placeholder="0.00" class="col-xs-8 form-control" name="amount" id="transfer_amount" style="width: 85%;">
                                                                    <label style="padding: 5px 0px 5px 5px; width: 10%; line-height: 40px;" class="col-lg-2"><?php echo strtoupper($currency_info->currency_unit);?></label>
                                                                    <!-- <span style="background: none; border: medium none; line-height: 39px;" class="col-xs-2 input-group-addon"><?php echo strtoupper($currency_info->currency_unit);?></span> -->
                                                                </div>
                                                                <div class="messageContainer"></div>
                                                                <?php echo form_error('amount', '<span class="help-block">', '</span>'); ?>
                                                            </div>
                                                            <div id="blan" style="display:none;color:#d84315;" class="error_msg1"><?php echo $this->lang->line('fund_balance'); ?></div>
                                                        </div>

                                                    </li>

                                                    <li>
                                                        <div class="form-group">
                                                            <p class="control-label col-lg-4 text-semibold"><?php echo $this->lang->line('fund_transfer_fee'); ?></p>
                                                            <div class="col-lg-2"><p>:</p></div>
                                                            <div class="col-lg-4">
                                                                <label style="margin-top: 5px;" ><strong id="trans_fee"><?php echo $this->data['transfer_fee'] ?>%</strong> will be deducted</label>
                                                                <input type="hidden" id="transfee" name="transfee" value="">
                                                            </div>
                                                        </div>
                                                        <div class="messageContainer"></div>
                                                    </li>

                                                </div>
                                            </ul>
                                    </div>
                                </div>
                                <div class="col-lg-12">
                                    <div class="col-lg-5 col-lg-offset-4 ">
                                        <div class="cmmn">
                                            <div class="contact_page_btn">
                                                <button type="submit"><?php echo $this->lang->line('button_transfer'); ?></button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?php } else { ?>
                                <div class="row">
                                    <div class="col-lg-12">
                                        <p class="frgtpwd frgtpwd1 frgtpwdred">
                                            <i class="fa fa-thumbs-down"></i><?php echo "Transfer not allowed";?>
                                        </p>
                                    </div>
                                </div>
                            <?php } ?>
                            </div>
                            
                            <?php
                                $this->load->view('user/shortlinks');
                            ?>
                        </div>
                    </form>
                    
                </div>

            </section>
  
              <section class="dmain">
              </section>
            <?php
                $this->load->view('user/footer');
            ?>

        </section>

            <?php
                $this->load->view('user/common_script');
            ?>

        

        <!-- Bootsrap form validation JS files -->
        <script type="text/javascript" src="<?php echo base_url();?>assets/js/formValidation.js"></script>
        <script type="text/javascript" src="<?php echo base_url();?>assets/js/bootstrap.js"></script>

        <!--<script type="text/javascript" src="<?php echo base_url();?>assets/js/plugins/forms/validation/validate.min.js"></script>-->

        <script type="text/javascript">

        jQuery.noConflict();
        (function( $ ) {

            $(function() {

                $(document).ready(function() {

                    $('#transfer_amount').change(function(){

                        $.ajax({
                            type: 'post',
                            url : '<?php echo base_url();?>user/fundtransfer/transationfee',
                            data : {'amount':$('#transfer_amount').val()},
                            success : function(msg)
                            {
                                if(msg) {
                                    $('#trans_fee').html(msg);
                                }
                            }
                        });

                    })

                    $.ajax({
                        type: 'post',
                        url : '<?php echo base_url();?>user/fundtransfer/checkbalance',
                        success : function(msg)
                        {
                            if(msg) {
                                $('#balanceVal').html(msg);
                            
                                if(msg=='<?php echo number_format('0',$currency_info->deimal_point, '.', ''); ?>' || msg < '0') {
                            
                                    $('#ip-exist').css('display','block');
                                    $('#balanceVal').css('color','#d84315');
                                    $('#deduct').css('color','#d84315');
                                    $('.error_msg').parent().parent().addClass('has-error');
                                    $('#btn').addClass('disabled');

                                } else {

                                    $('#ip-exist').css('display','none');
                                    $('#balanceVal').css('color','#333333');
                                    $('#deduct').css('color','#333333');
                                    $('.error_msg').parent().parent().removeClass('has-error');
                                }
                            }
                        }
                    });
                    
                    /*
                    $('#payment_check').change(function(){

                        var payid = $('#payment_check').val();

                        if($('#transfer_amount').val()) {
                            $('.fundtransfer').formValidation('revalidateField', 'amount');
                        }

                        if(payid) {
                            
                        }
              
                    })
                    */

                  

                    $('.fundtransfer').formValidation({
                        framework: 'bootstrap',
                        excluded: [':disabled'],

                        err: {
                            container: function($field, validator) {
                                return $field.parent().next('.messageContainer');
                            }
                        },
                        row: {
                            valid: 'has-success1',
                            invalid: 'has-error1'
                        },
                        fields: {
                            payment: {
                                validators: {
                                    notEmpty: {
                                        message: '<?php echo $this->lang->line("fund_transfer_gateway_required");?>'
                                    },
                                    // remote: {
                                    //     url: function(validator, $field, value) {
                                            
                                    //         return '<?php echo base_url();?>user/fundtransfer/checkbalance';
                                    //     },
                                    //     type: 'POST',
                                    //     delay: 1000
                                    // }
                                }
                            },
                            amount: {
                                validators: {
                                    notEmpty: {
                                        message: '<?php echo $this->lang->line("fund_transfer_amount_required");?>'
                                    },
                                    regexp: {
                                        regexp: /^[0-9.]+$/,
                                        message: '<?php echo $this->lang->line("fund_transfer_amount_invalid"); ?>'
                                    },
                                    remote: {
                                        url: function(validator, $field, value) {
                                            
                                            return '<?php echo base_url();?>user/fundtransfer/checkfee/'+$('#payment_check').val();
                                        },
                                        type: 'POST',
                                        delay: 1000
                                    }
                                }
                            },
                            receiver: {
                                validators: {
                                    notEmpty: {
                                        message: '<?php echo $this->lang->line("fund_transfer_required_receiver");?>'
                                    },
                                    remote: {
                                        url: function(validator, $field, value) {
                                            
                                            return '<?php echo base_url();?>user/fundtransfer/validreceiver';
                                        },
                                        type: 'POST',
                                        delay: 1000,
                                        message: '<?php echo $this->lang->line("fund_transfer_invalid_receiver"); ?>'
                                    }

                                }
                            }
                           
                        }
                    })

                    jQuery("#owl-example").owlCarousel({   
                        nav:true,
                        items : 8, 
                        itemsCustom : false,
                        itemsDesktop : [1199,8],
                        itemsDesktopSmall : [980,5],
                        itemsTablet: [768,5],
                        itemsTabletSmall: [768,4],
                        itemsMobile : [479,2],
                        singleItem : false,
                        itemsScaleUp : true,
                        navigation : true,
                        navigationText : ["",""],
                        rewindNav : true,
                        scrollPerPage : true,
                    });
                })
                
            })
        })(jQuery);
        </script>
        
    </body>
</html>
