<?php $this->load->view('header');?>
		
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            &nbsp;
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo base_url();?>"><?php echo $this->lang->line('hf_home');?></a></li>
              <li class="breadcrumb-item"><?php echo $this->lang->line('hf_package_manager');?></li>
			  <li class="breadcrumb-item active"><?php echo $this->lang->line('hf_topup_package');?></li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

	<!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title"><?php echo $this->lang->line('hf_topup_package');?></h3>

            <div class="card-tools">
              <b class="text-success"><?php echo $this->lang->line('buy_current_package');?>:</b> 
			  <span><?php echo $this->lang->line(get_package($package_type));?></span> &nbsp;|&nbsp; 
			  <b class="text-success"><?php echo $this->lang->line('buy_current_balance');?>:</b> 
			  <span><?php echo (isset($balance) ? $balance : '0.00')?></span> &nbsp;|&nbsp; 
			  <b class="text-success"><?php echo $this->lang->line('wallet_1');?>:</b> 
			  <span><?php echo (isset($v_unit) ? $v_unit : '');?></span>
            </div>
          </div>
          <!-- /.card-header -->
          <div class="card-body">
			<form class="form-horizontal" id="topup-package-form">
				<div class="form-group row">
					<label for="transaction_amount" class="col-sm-2 col-form-label"><?php echo $this->lang->line('buy_topup_amount');?></label>
					<div class="col-sm-3">
						<?php
							$current_package_price = 0;
							if($package->num_rows() > 0) {
								foreach($package->result() as $row) {
									if($row->package_id == $package_type) {
										$current_package_price = $row->package_price;
									}
								}
							}
						?>
					  <label class="custom-label"><?php $topup_diff = ($current_package_price - $balance); echo (($topup_diff > 0) ? $topup_diff : 0);?></label>
					</div>
				</div>
				<div class="form-group row">
					<label for="security_password" class="col-sm-2 col-form-label"><?php echo $this->lang->line('buy_security_password');?></label>
					<div class="col-sm-3">
					  <input type="password" class="form-control" id="security_password" name="security_password" placeholder="<?php echo $this->lang->line('buy_security_password_fill_in_message');?>">
					</div>
				</div>
				<div class="form-group row">
					<div class="offset-sm-2 col-sm-10">
					  <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
					  <button onclick="topup_package_submit()" type="button" class="btn btn-primary"><?php echo $this->lang->line('buy_topup_package');?></button>
					</div>
				</div>
			</form>
          </div>
          <!-- /.card-body -->
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
		
<?php $this->load->view('footer');?>		