<%  @calendar_view_disable=1    %>
<div class="settings_common_container">

	<div class="settings_common_header">
		
		<%= link_to t(:cancel), settings_users_path, class:"href_delete_button", style:"float:left" %>
		<div class="settings_common_header_text"><%= t('.edit_user')%></div>
	</div>
	<div class="settings_common_table_container" style="padding-top:10px">
		<%= form_for :user, url: settings_user_path(@user), method: :patch do |f| %>
		<table class="table_body">
			
  		  	<tr>
     		   	<td align="right"><%= f.label "#{t('.user_name')}:" %></td>
   				<td><%= f.text_field :username, disabled: true, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
				<td align="right"><%= f.label "#{t('.group')}:" %></td>
  				<td><%= f.select "user_group_id", UserGroup.all.collect {|p| [ p.name_rus, p.id ] } %></td>
  		  	</tr>
 		   	<tr>
     		   	<td align="right"><%= f.label "#{t('.new_pass')}:" %></td>
     		   	<td><%= f.password_field :new_password, :onchange => 'check_passwords()', :onkeyup => 'check_passwords()', :class => "text_field_relative"  %></td>
  		 	</tr>
  		  	<tr>
    			<td align="right"><%= f.label "#{t('.retype_pass')}:" %></td>
    			<td><%= f.password_field :re_password, :onchange => 'check_passwords()', :onkeyup => 'check_passwords()', :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr id="update_user_confirm_button">
   			 	<td colspan="2" align="center"><%= f.submit t(:update) %></td>
  		  	</tr>
  		  	<tr id="update_user_confirm_error" style="display:none">
   			 	<td colspan="2" align="center" style="color:<%= $red %>"><%= t('.pass_no_match')%></td>
  		  	</tr>
			
		</table>
		<% end %>
	</div>
</div>
<script>
function check_passwords(){
	pass=document.getElementById('user_new_password').value
	re_pass=document.getElementById('user_re_password').value
	if (pass == re_pass){
		document.getElementById('update_user_confirm_button').style.display=''
		document.getElementById('update_user_confirm_error').style.display='none'
	}else{
		document.getElementById('update_user_confirm_button').style.display='none'
		document.getElementById('update_user_confirm_error').style.display=''
	}
}

</script>

<script>
$(document).ready(
	function() { 
		$(".settings_common_table_container").niceScroll(scroll_settings);
	}
);
</script>