<%  @calendar_view_disable=1    %>
<style>
#login_info_file_upload > .button{
	width:80px;
	position:relative;
	float:left;
}
#login_info_file_upload > #login_info_file_upload_label{
	width:180px;
	position:relative;
	float:left;
	line-height:15px;
	padding-left:10px;
	text-align:center;
}
#login_info_file_upload > input{
	display:none;
}
</style>
<div class="settings_common_container">

	<div class="settings_common_header">
		
		<%= link_to t(:cancel), settings_logins_info_index_path, class:"href_delete_button", style:"float:left" %>
		<div class="settings_common_header_text"><%= t('.edit_login') %></div>
	</div>
	<div class="settings_common_table_container" style="padding-top:10px">
		<%= form_for :login, url: settings_logins_info_path(@login), method: :patch do |f| %>
		<table class="table_body">
  		  	
  		  	<tr>
     		   	<td align="right"><%= t(:login) %></td>
   				<td><%= f.text_field :name, disabled: true, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right"><%= t('.photo')%></td>
   				<td>
					<div id="login_info_file_upload">
					        <div onclick="$('#login_photo').click()" class="button"><%= t(".select")%></div>
					        <div id="login_info_file_upload_label"><%= t(".select_file")%> (<b>.jpg</b>, <b>.png</b>)<br><div style="font-size:12px"><%= t(".file_size")%></div></div>
					        <%= f.file_field :photo, :style => "", :onchange => "login_info_edit_prepare_name(this.value)".html_safe, :accept => ".png,.jpg"  %>
					    </div>
				</td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right"><%= t(".full_name")%></td>
   				<td><%= f.text_field :full_name, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
				<td align="right"><%= t(:offices)%></td>
  				<td><%= f.select "office_id", Office.all.collect {|p| [ p.name, p.id ] } %></td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right"><%= t('.department')%></td>
   				<td><%= f.text_field :department, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right">Email</td>
   				<td><%= f.text_field :email, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right"><%= t('.phone')%></td>
   				<td><%= f.text_field :phone, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	<tr>
     		   	<td align="right"><%= t('.mobile_phone')%></td>
   				<td><%= f.text_field :mobile_phone, :class => "text_field_relative"  %></td>
  		  	</tr>
  		  	
  		  	<tr id="update_user_confirm_button">
   			 	<td colspan="2" align="center"><%= f.submit t(:update) %></td>
  		  	</tr>
			
		</table>
		<% end %>
	</div>
</div>


<script>
	var calendar_from_date=new Date()
	var calendar_to_date=new Date()
$(document).ready(
	function() { 
		$(".settings_common_table_container").niceScroll(scroll_settings);
	}
);
function login_info_edit_prepare_name(file_name){
	file_name_array=file_name.split('\\')
	file_name_prepared=file_name_array[file_name_array.length-1]
	file_name_prepared=file_name_prepared.length > 12 ? file_name_prepared.substring(0,20)+'...' : file_name_prepared
	file_format = file_name_prepared.split('.')[file_name_prepared.split('.').length-1]
	if (file_format == 'png' || file_format == 'jpg'){
		document.getElementById('login_info_file_upload_label').style.lineHeight='30px'
		document.getElementById('login_info_file_upload_label').innerHTML=file_name_prepared
	}else{
		document.getElementById('login_photo').value = ''
		document.getElementById('login_info_file_upload_label').style.lineHeight='15px'
		document.getElementById('login_info_file_upload_label').innerHTML='Выберите файл (<b>.jpg</b>, <b>.png</b>)<br><div style="font-size:12px">размер от 120x120 пикселей</div>'
	}
}
</script>