<% if(Setting.plugin_redmine_wktime['label_no_additional_details_for_user'].blank? && Setting.plugin_redmine_wktime['label_no_additional_details_for_user'].to_i == 0) %>
<%= javascript_include_tag 'wkuser', :plugin => "redmine_wktime" %>
<%
	roleObj = Role.order(:name)
	roleArr = nil
	roleArr = roleObj.pluck(:name, :id)
	genderHash = {'M' => "#{l(:gender_hash_male)}", 'F' => "#{l(:gender_hash_female)}", 'O' => "#{l(:gender_hash_others)}"}
	wkexpense_helper = Object.new.extend(WkexpenseHelper)
	currArr = wkexpense_helper.options_for_currency
	wkenum_helper = Object.new.extend(WkcrmenumerationHelper)
	locationArr = nil
	locationobj = WkLocation.order(:name)
	locationArr = locationobj.pluck(:name, :id)
	departmentArr = WkCrmEnumeration.where(:enum_type => 'DP').order(:name).pluck(:name, :id)
	maritalArr = WkCrmEnumeration.where(:enum_type => 'MS').order(:name).pluck(:name, :id)
	emergContactTypeArr = WkCrmEnumeration.where(:enum_type => 'EC').order(:name).pluck(:name, :id)
	dept_section_arr = WkCrmEnumeration.where(:enum_type => 'DS').order(:position).pluck(:name, :id)
	shiftArr = nil
	shiftObj = WkShift.where(:in_active => true, :is_schedulable => true).order(:name)
	shiftArr = shiftObj.pluck(:name, :id)
	shiftArr.unshift(["",''])
	disable = @user == User.current ? true : false
	wkcrm_helper = Object.new.extend(WkcrmHelper)
%>
</fieldset>
<div >
	<fieldset class="box tabular">
		<legend><%=l(:label_details)%></legend>
		<%= labelled_fields_for :erpmineuser, @user.erpmineuser do |user_fields| %>
			<% if !@user&.id&.present? %>
				<p>
					<label><%= l(:label_hiring_employees) %></label>
					<%= select_tag :hiring_employee, options_for_select(wkcrm_helper.hiring_employees), include_blank: true, onchange: "getEmpDetails()" %>
				</p>
			<% end %>
			<p><%= user_fields.date_field :join_date, :disabled => disable %></p>
			<%= calendar_for('erpmine_join_date') %>
			<p><%= user_fields.date_field :termination_date, :disabled => disable %></p>
			<%= calendar_for('erpmine_termination_date') %>
			<p><%= user_fields.date_field :birth_date, :disabled => disable %></p>
			<%= calendar_for('erpmine_birth_date') %>
			<% unless myaccount %>
				<p><%= user_fields.text_field :billing_rate, :disabled => disable %></p>
				<p><%= user_fields.select :billing_currency, currArr, {}, :disabled => disable %></p>
			<% end %>
			<p><%= user_fields.select :role_id, roleArr, {}, :disabled => disable %></p>
			<p><%= user_fields.select :gender, genderHash.invert, {}, :disabled => disable %></p>
			<p><%= user_fields.select :marital_id, maritalArr, {label:l(:label_marital_status)}, :disabled => disable %></p>
			<p><%= user_fields.text_field :emergency_contact, :disabled => disable %></p>
			<p><%= user_fields.select :emerg_type_id, emergContactTypeArr, {label:l(:label_emerg_contact_type)}, :disabled => disable %></p>
			<p><%= user_fields.text_field :employee_id, label:l(:label_employee_id), :disabled => disable %></p>
			<p><%= user_fields.text_field :state_insurance, label:l(:label_state_insurance), :disabled => disable %></p>

			<p><%= user_fields.select :location_id, locationArr, {}, :disabled => disable %></p>
			<p><%= user_fields.select :department_id, departmentArr, {}, :disabled => disable %></p>
			<p><%= user_fields.select :dept_section_id, dept_section_arr, {label:l(:label_dept_section)}, :disabled => disable %></p>
			<p><%= user_fields.check_box :is_schedulable, :disabled => disable %></p>
			<p><%= user_fields.select :shift_id, shiftArr, {}, :disabled => disable %></p>
			<p><%= user_fields.text_field :bank_name, :disabled => disable %></p>
			<% if !@user&.id&.present? %>
				<p><%= user_fields.text_field :account_number, :disabled => disable %></p>
			<% else %>
				<p>
					<%= user_fields.text_field :account_number, :value => @user.erpmineuser&.account_number.present? ? WkUser.showEncryptdData(@user&.id, 'account_number') : '', :disabled => true %>
					<%= link_to image_tag('withoutcommant.png', plugin: "redmine_wktime"), "javascript: showDetails('#{@user&.id}', '#{'account_number'}', '#{l(:label_account_number)}', #{disable});" %>
				</p>
			<% end %>
			<p><%= user_fields.text_field :bank_code, :disabled => disable %></p>
			<% if !@user&.id&.present? %>
				<p><%= user_fields.text_field :tax_id, :disabled => disable %></p>
			<% else %>
				<p>
					<%= user_fields.text_field :tax_id, :value => @user.erpmineuser&.tax_id.present? ? WkUser.showEncryptdData(@user&.id, 'tax_id') : '', :disabled => true %>
					<%= link_to image_tag('withoutcommant.png', plugin: "redmine_wktime"), "javascript: showDetails('#{@user&.id}', '#{'tax_id'}', '#{l(:field_tax)}', #{disable});"%>
				</p>
			<% end %>
			<% if !@user&.id&.present? %>
				<p><%= user_fields.text_field :ss_id, :disabled => disable %></p>
			<% else %>
				<p>
					<%= user_fields.text_field :ss_id, :value => @user.erpmineuser&.ss_id.present? ? WkUser.showEncryptdData(@user&.id, 'ss_id') : '', :disabled => true %>
					<%= link_to image_tag('withoutcommant.png', plugin: "redmine_wktime"), "javascript: showDetails('#{@user&.id}', '#{'ss_id'}',  '#{l(:field_ss)}', #{disable});" %>
				</p>
			<% end %>
				<p><%= user_fields.text_field :retirement_account, label:l(:field_retirement_account),:disabled => disable %></p>
			<p><%= user_fields.text_area :notes, :disabled => disable %></p>
			<p><%= user_fields.text_field :id1, :disabled => disable %></p>
			<p><%= user_fields.text_field :id2, :disabled => disable %></p>
			<p><%= user_fields.text_field :id3, :disabled => disable %></p>
			<p><%= user_fields.text_field :custom_number1, :disabled => disable %></p>
			<p><%= user_fields.text_field :custom_number2, :disabled => disable %></p>
			<p><%= user_fields.date_field :custom_date1, :disabled => disable %></p>
			<%= calendar_for('erpmine_custom_date1') %>
			<p><%= user_fields.date_field :custom_date2, :disabled => disable %></p>
			<%= calendar_for('erpmine_custom_date2') %>
		<% end %>
	</fieldset>
</div>
<% end %>

<div id="user-dlg"></div>