<?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_withdrawal');?></li>
			  <li class="breadcrumb-item active"><?php echo $this->lang->line('hf_withdraw_request');?></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_withdraw_request');?></h3>

            <div class="card-tools">
              <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="withdrawal-form">
				<p class="text-danger"><?php echo str_replace('_MIN_', (isset($setting['min_withdraw']) ? $setting['min_withdraw'] : 0), $this->lang->line('withdraw_minimum_maximum_amount'));?></p>
				<div class="form-group row">
					<label for="currency_id" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_withdrawal_type');?></label>
					<div class="col-sm-3">
						<select class="form-control" id="currency_id" name="currency_id" onchange="change_withdrawal_type(this.value)">
							<?php if($this->session->userdata('member_country') == 'MY') {?>
							<option value="3"><?php echo $this->lang->line('currency_myr_without_symbol');?></option>
							<?php }?>
							<option value="5"><?php echo $this->lang->line('currency_usdt');?></option>
						</select>
					</div>
				</div>
				<div class="form-group row">
					<label for="transaction_amount_2" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_withdraw_amount');?> (<?php echo $this->lang->line('currency_myr_without_symbol');?>)</label>
					<div class="col-sm-3">
					  <input type="text" class="form-control" id="transaction_amount_2" name="transaction_amount" placeholder="<?php echo $this->lang->line('withdraw_amount_must_fill_in_message');?>">
					</div>
				</div>
				<div class="form-group row">
					<label for="currency_rate" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_currency_rate');?></label>
					<div class="col-sm-10">
					  <label id="currency_rate" class="custom-label">
						<?php 
							$display_currency_symbol = $this->lang->line('currency_usdt');
							$currency_rate_display = $currency[5]['out'];
							switch($this->session->userdata('member_country')) {
								// case 'CN': $display_currency_symbol = $this->lang->line('currency_cny_without_symbol'); $currency_rate_display = $currency[1]['out']; break;
								// case 'HK': $display_currency_symbol = $this->lang->line('currency_hkd_without_symbol'); $currency_rate_display = $currency[2]['out']; break;
								case 'MY': $display_currency_symbol = $this->lang->line('currency_myr_without_symbol'); $currency_rate_display = $currency[3]['out']; break;
								default: $display_currency_symbol = $this->lang->line('currency_usdt'); $currency_rate_display = $currency[5]['out']; break;
							}
							
							echo $currency_rate_display;
						?>		
					  </label>
					</div>
				</div>
				<div class="form-group row" id="handling_fee_panel_1" <?php echo (($this->session->userdata('member_country') == 'MY') ? '' : 'style="display: none;"');?>>
					<label for="handling_fee_1" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_handling_fee');?> (%)</label>
					<div class="col-sm-10">
					  <label id="handling_fee_1" class="custom-label"><?php echo (isset($setting['withdrawal_rate']) ? $setting['withdrawal_rate'] : 0);?></label>
					</div>
				</div>
				<div class="form-group row" id="handling_fee_panel_2" <?php echo (($this->session->userdata('member_country') == 'MY') ? 'style="display: none;"' : '');?>>
					<label for="handling_fee_2" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_handling_fee');?> (<?php echo $this->lang->line('currency_usdt');?>)</label>
					<div class="col-sm-10">
					  <label id="handling_fee_2" class="custom-label"><?php echo (isset($setting['usdt_withdrawal_fee']) ? $setting['usdt_withdrawal_fee'] : 0);?></label>
					</div>
				</div>
				<div class="form-group row">
					<label for="actual_amount" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_actual_amount');?> (<span id="currency_name"><?php echo $display_currency_symbol;?></span>)</label>
					<div class="col-sm-10">
					  <label id="actual_amount" class="custom-label">0.00</label>
					</div>
				</div>
				<div class="form-group row">
					<label for="security_password" class="col-sm-2 col-form-label"><?php echo $this->lang->line('withdraw_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('withdraw_security_password_must_fill_in_message');?>">
					</div>
				</div>
				<div class="form-group row">
					<div class="offset-sm-2 col-sm-10">
					  <input type="hidden" id="cny_rate" name="cny_rate" value="<?php echo $currency[1]['out'];?>" />
					  <input type="hidden" id="hkd_rate" name="hkd_rate" value="<?php echo $currency[2]['out'];?>" />
					  <input type="hidden" id="myr_rate" name="myr_rate" value="<?php echo $currency[3]['out'];?>" />
					  <input type="hidden" id="usdt_rate" name="usdt_rate" value="<?php echo $currency[5]['out'];?>" />
					  <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
					  <button onclick="withdrawal_submit()" type="button" class="btn btn-primary"><?php echo $this->lang->line('withdraw_submit');?></button>
					</div>
				</div>
			</form>
          </div>
          <!-- /.card-body -->
        </div>
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
		
<?php $this->load->view('footer');?>		