<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %>
	<% 
		activeProjects = Project.where("#{Project.table_name}.status not in(#{Project::STATUS_CLOSED},#{Project::STATUS_ARCHIVED})").order('name') 
		projArr = options_for_wktime_project(activeProjects,true) 	
		accArr = options_for_wktime_account(needBlankAcc, controller.getOrderAccountType, controller.additionalAccountType)
		type = controller.getOrderAccountType
		if parentType == "WkCrmContact" || params[:related_to] == "WkCrmContact"
			type = controller.getOrderContactType
		end
		if !parentId.blank? && !parentType.blank?
			accArr = relatedValues(parentType, parentId, type, false, controller.additionalContactType, controller.additionalAccountType)	
		elsif !params[:related_parent].blank? && params[:related_to]
			accArr = relatedValues(params[:related_to], params[:related_parent], type, false, controller.additionalContactType, controller.additionalAccountType)		
		end
	%>
	<script type="text/javascript"> 
		actRelatedUrl="<%= "#{url_for(:controller => "wkcrm", :action => 'getActRelatedIds', :additionalContactType => controller.additionalContactType, :additionalAccountType => controller.additionalAccountType)}" %>";
		paymentUrl="<%= "#{url_for(:controller => "wkpaymententity", :action => 'getBillableProjIds')}" %>";
	</script>
			<th align="left"><label><%= l(:field_type) %></label></th>
			<td align="left" style="padding-left:40px;">
				<%=h select_tag('related_to', options_for_parent_select(parentType), :onchange => "actRelatedDd(#{User.current.id}, false, false, '#{controller.getOrderAccountType}', '#{controller.getOrderContactType}', true );", :disabled => isDisable) %>
			</td>
			<th align="left"><label><%= l(:field_name) %></label></th>
			<td align="left" style="padding-left:40px;">
				<%=h select_tag('related_parent', options_for_select(accArr, :selected => parentId.nil? ? accArr : parentId), :onchange => "parentChanged(#{User.current.id});submitFiletrForm();", :disabled => isDisable) %>
			</td>
			<% if showProject %>
				<th align="left"><label><%= l(:label_project) %></label></th>
				<td align="left" style="padding-left:40px;">
					<%=h select_tag('project_id', options_for_select([["",""]] + (@projects.blank? ? [] : @projects), :selected => projectId.nil? ? projArr : projectId), :disabled => isDisable) %>		
				</td>
			<% end %>

