<tr class="form">
  <td>
    <%= f.hidden_field :entity_type %>
    <%= f.hidden_field :entity_id %>
    <span class="input-append">
      <%= text_field_tag 'easy_entity_activity[start_time][date]', User.current.user_time_in_zone(f.object.start_time).try(:to_date), size: 10, id: :easy_entity_activity_start_time_date %>
      <%= calendar_for('easy_entity_activity_start_time_date') %>
      <%= render(:partial => 'common/form_field_time_select', locals: {field_name_prefix: 'easy_entity_activity', attribute: 'start_time', value: f.object.start_time && User.current.user_time_in_zone(f.object.start_time)}) %>
     </span>
     <span class="all-day">
        <% box = f.check_box :all_day %>
        <%= label_tag("#{f.object_name}_all_day", box + l(:field_all_day), :class => 'checkbox inline') %>
     </span>
  </td>
  <td>
    <%= f.select :category_id, EasyEntityActivityCategory.sorted.collect{|x| [x.name, x.id]} %>
  </td>
  <td>
    <%= f.check_box :is_finished %>
  </td>
  <%
    selected = f.object.easy_entity_activity_attendees.where(entity_type: 'Principal').map { |x| {id: x.entity_id, value: x.to_s} }
    selected << {id: User.current.id, value: User.current.name} if selected.empty?
  %>
  <td>
    <div class="splitcontent">
      <div class="splitcontentleft">
        <%= label_tag :easy_entity_activity_attendees_Principal_, l(:label_user_plural) %><br>
        <%= autocomplete_field_tag('easy_entity_activity_attendees[Principal][]', easy_autocomplete_path('users'), selected, show_toggle_button: true, rootElement: 'users', preload: false) %>
      </div>
      <%= call_hook :view_issues_easy_entity_activity_form_bottom, f: f %>
    </div>
  </td>
  <td>
    <%= f.submit l(:button_save), class: 'button-positive' %>
  </td>
</tr>
<tr class="form">
  <td colspan="5">
    <%= f.text_area :description %>
  </td>
</tr>
