<?php $this->load->view('header');?>

	<div class="row-fluid">
		<div class="span12">

			<!-- BEGIN PAGE TITLE & BREADCRUMB-->

			<h3 class="page-title"><?php echo $this->lang->line('hf_add_new_member');?> </h3>

			<ul class="breadcrumb">

				<li><i class="icon-home"></i><a href="<?php echo base_url();?>home/"><?php echo $this->lang->line('hf_home');?></a> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_member_manager');?> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_add_new_member');?></li>
			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	
	<div class="row-fluid">
		<div class="span12">
			<div class="portlet box blue">

				<div class="portlet-title">

					<div class="caption"><i class="icon-reorder"></i><?php echo $this->lang->line('hf_add_new_member');?></div>

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="member-form" class="form-horizontal" method="post" action="<?php echo base_url();?>member/submit/">
						<?php 
							$alert_box = '';
							$alert_msg = '';
							
							if($this->session->userdata('form_msg_type') == 100) {
								$alert_box = 'success';
								$alert_msg = $this->session->userdata('form_msg');
							}
							else if($this->session->userdata('form_msg_type') == 200) {
								$alert_box = 'error';
								$alert_msg = $this->session->userdata('form_msg');
							}
							
							if($this->session->userdata('form_msg_type') == 100 OR $this->session->userdata('form_msg_type') == 200) {
								$this->session->unset_userdata(array('form_msg_type' => '', 'form_msg' => ''));
							}

							if( ! empty($alert_msg)) {
						?>
						<div class="alert alert-<?php echo $alert_box;?>">
							<button class="close" data-dismiss="alert"></button>
							<?php echo $alert_msg;?>
						</div>
						<?php }?>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_personal_info');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_username');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="username" name="username" class="m-wrap span4" value="<?php echo isset($username) ? htmlspecialchars($username, ENT_QUOTES) : '';?>">
								<span class="help-block"><?php echo $this->lang->line('registration_username_format');?></span>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="password" name="password" class="m-wrap span4" value="">
								<span class="help-block"><?php echo $this->lang->line('registration_password_format');?></span>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_confirm_password');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="password" id="confirm_password" name="confirm_password" class="m-wrap span4" value="">
								<span class="help-block"><?php echo $this->lang->line('registration_confirm_password_format');?></span>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_status');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="active" name="active" class="m-wrap span4">
									<?php
										foreach(get_account_status() as $k => $v) {
											if(isset($active)) {
												if($k == $active) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_direct_sponsor');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="direct_sponsor" name="direct_sponsor" class="m-wrap span4" value="<?php echo isset($direct_sponsor) ? htmlspecialchars($direct_sponsor, ENT_QUOTES) : '';?>">
							</div>
						</div>  
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_introducer');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="introducer" name="introducer" class="m-wrap span4" value="<?php echo isset($introducer) ? htmlspecialchars($introducer, ENT_QUOTES) : '';?>">
							</div>
						</div>  
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_name');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="full_name" name="full_name" class="m-wrap span4" value="<?php echo isset($full_name) ? htmlspecialchars($full_name, ENT_QUOTES) : '';?>">
							</div>
						</div>    
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_date_of_birth');?>: </label>
							<div class="controls">
								<div class="input-append date date-picker" data-date="<?php echo date('Y-m-d');?>" data-date-format="yyyy-mm-dd" data-date-viewmode="years">
									<input class="m-wrap m-ctrl-medium date-picker" readonly size="16" type="text" id="dob" name="dob" value="<?php echo isset($dob) ? htmlspecialchars($dob, ENT_QUOTES) : '';?>"><span class="add-on"><i class="icon-calendar"></i></span>
								</div>
							</div>
						</div>  
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_gender');?>: </label>
							<div class="controls">
								<select id="gender" name="gender" class="m-wrap span2">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_gender() as $k => $v) {
											if(isset($gender)) {
												if($k == $gender) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_id_file');?>: </label>
							<div class="controls">
								<select id="id_type" name="id_type" class="m-wrap span2">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_id_type() as $k => $v) {
											if(isset($id_type)) {
												if($k == $id_type) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_id_no');?>: </label>
							<div class="controls">
								<input type="text" id="id_no" name="id_no" class="m-wrap span4" value="<?php echo isset($id_no) ? htmlspecialchars($id_no, ENT_QUOTES) : '';?>">
							</div>
						</div>  
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_nationality');?>: </label>
							<div class="controls">
								<select id="nationality" name="nationality" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($nationality)) {
												if($k == $nationality) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'VN') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>  
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_email');?>:</label>
							<div class="controls">
								<input type="text" id="email" name="email" class="m-wrap span4" value="<?php echo isset($email) ? htmlspecialchars($email, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_mobile_number');?>: </label>
							<div class="controls">
								<input type="text" id="mobile_no" name="mobile_no" class="m-wrap span4" value="<?php echo isset($mobile_no) ? htmlspecialchars($mobile_no, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_address');?>: </label>
							<div class="controls">
								<input type="text" id="address" name="address" class="m-wrap span4" value="<?php echo isset($address) ? htmlspecialchars($address, ENT_QUOTES) : '';?>">
							</div>
						</div>

						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_city_town');?>: </label>
							<div class="controls">
								<input type="text" id="city" name="city" class="m-wrap span4" value="<?php echo isset($city) ? htmlspecialchars($city, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_zip_postal_code');?>: </label>
							<div class="controls">
								<input type="text" id="postal_code" name="postal_code" class="m-wrap span4" value="<?php echo isset($postal_code) ? htmlspecialchars($postal_code, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_state_province');?>: </label>
							<div class="controls">
								<input type="text" id="state" name="state" class="m-wrap span4" value="<?php echo isset($state) ? htmlspecialchars($state, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_country');?>: </label>
							<div class="controls">
								<select id="country" name="country" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($country)) {
												if($k == $country) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'VN') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_package');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_package');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="package_type" name="package_type" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										if($package_listing->num_rows() > 0) {
											foreach($package_listing->result() as $row) {
												if(isset($package_type)) {
													if($row->package_id == $package_type) {
														echo '<option value="' . $row->package_id . '" selected="selected">' . $row->package_name . '</option>';
													}
													else {
														echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
													}
												}
												else {
													echo '<option value="' . $row->package_id. '">' . $row->package_name . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_member_type');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="member_type" name="member_type" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_member_type() as $k => $v) {
											if(isset($member_type)) {
												if($k == $member_type) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 2) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<h3 class="form-section"><?php echo $this->lang->line('registration_bank_info');?></h3>

						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_name');?>: </label>
							<div class="controls">
								<input type="text" id="bank_name" name="bank_name" class="m-wrap span4" value="<?php echo isset($bank_name) ? htmlspecialchars($bank_name, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_account_no');?>: </label>
							<div class="controls">
								<input type="text" id="bank_account_no" name="bank_account_no" class="m-wrap span4" value="<?php echo isset($bank_account_no) ? htmlspecialchars($bank_account_no, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_account_holder_name');?>: </label>
							<div class="controls">
								<input type="text" id="account_holder_name" name="account_holder_name" class="m-wrap span4" value="<?php echo isset($account_holder_name) ? htmlspecialchars($account_holder_name, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_address');?>: </label>
							<div class="controls">
								<input type="text" id="bank_address" name="bank_address" class="m-wrap span4" value="<?php echo isset($bank_address) ? htmlspecialchars($bank_address, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_country');?>: </label>
							<div class="controls">
								<select id="bank_country" name="bank_country" class="m-wrap span4">
									<option value=""><?php echo $this->lang->line('registration_select');?></option>
									<?php
										foreach(get_country_name() as $k => $v) {
											if(isset($bank_country)) {
												if($k == $bank_country) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 'VN') {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group" style="display: none;">
							<label class="control-label" ><?php echo $this->lang->line('registration_bank_swift_code');?>: </label>
							<div class="controls">
								<input type="text" id="bank_swift_code" name="bank_swift_code" class="m-wrap span4" value="<?php echo isset($bank_swift_code) ? htmlspecialchars($bank_swift_code, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_coin_wallet_address');?>: </label>
							<div class="controls">
								<input type="text" id="wallet_address" name="wallet_address" class="m-wrap span4" value="<?php echo isset($wallet_address) ? htmlspecialchars($wallet_address, ENT_QUOTES) : '';?>">
							</div>
						</div>

						<h3 class="form-section"><?php echo $this->lang->line('registration_permission');?></h3>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_withdraw_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_withdraw" name="allowed_withdraw" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_withdraw)) {
												if($k == $allowed_withdraw) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_withdraw_unlimited');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="unlimited_withdraw" name="unlimited_withdraw" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($unlimited_withdraw)) {
												if($k == $unlimited_withdraw) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_transfer_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_transfer" name="allowed_transfer" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_transfer)) {
												if($k == $allowed_transfer) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_convert_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_convert" name="allowed_convert" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_convert)) {
												if($k == $allowed_convert) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_topup_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_topup" name="allowed_topup" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_topup)) {
												if($k == $allowed_topup) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('registration_game_activated');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="allowed_game" name="allowed_game" class="m-wrap span4">
									<?php
										foreach(get_activated_status() as $k => $v) {
											if(isset($allowed_game)) {
												if($k == $allowed_game) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
											else {
												if($k == 1) {
													echo '<option value="' . $k . '" selected="selected">' . $this->lang->line($v) . '</option>';
												}
												else {
													echo '<option value="' . $k. '">' . $this->lang->line($v) . '</option>';
												}
											}
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('registration_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
			</div>					
		</div><!-- End span12 -->
		
	</div> <!-- End Row Fluid -->

<?php $this->load->view('footer');?>