<% # encoding: utf-8 %>

<% if !@member_lists.blank? %>	

<% @job_title_field = @member_lists.get_member_list_attribute_field("staff","job_title") %>
<% @job_business_field = @member_lists.get_member_list_attribute_field("staff","business") %>
		
		<% if @item.frontend_style == 'Single' or @item.frontend_style == 'Two' %>

			<section> 

				<div class="side"></div>
				<div class="main">
					
					<% if !@member_list_categorys.blank? %>
					<ul class="o-members-nav">
					<% @member_list_categorys.each do |mc| %>
						<li class="<%= (params[:mcid] == mc.id.to_s or @mcs.to_s == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li>
					<% end %>
					</ul>
					<% end %>

			<% if @item.frontend_style == 'Single' %>

					<div class="o-members">
						
						<%  @member_status.each do |ms| %>

						<% if @member_lists.where(:role_status_ids=>ms.id).count > 0  %>
						
						<h3 class="o-members-category h3"><%= ms.title %></h3>
						<ul class="o-members-list">

							<% @member_lists.where(:role_status_ids=>ms.id).each do |member| %>

							<li class="odd">
								<div class="o-members-pic"><%= show_avatar(member) %></div>
								<ul class="o-members-info">
									<% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
									   if @job_title != 'NoData' and !@job_title.blank?
									%>
									<li><b class="o-members-label">
										<%= @job_title_field.title %></b>
										<%= @job_title %>
									</li>
									<% end %>
									<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_staff_front_end_member_staff_list_path(member.id), {:class => "o-members-link"} %></li>
									<% if !member.office_tel.blank? %>
									<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
									<% end %>
									<li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li>
									
									<% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
									   if @job_business != 'NoData' and !@job_business.blank?
									%>
									<li><b class="o-members-label">
										<%= @job_business_field.title %></b>
										<%= @job_business %>
									</li>
									<% end %>
								</ul>
							</li>

							<% end %>
								
						</ul>
						
						<% end %>

						<% end %>

					</div>

			<% elsif @item.frontend_style == 'Two' %>

					<div class="o-members view-columns">

						<%  @member_status.each do |ms| %>

						<% if @member_lists.where(:role_status_ids=>ms.id).count > 0  %>

						<h3 class="o-members-category h3"><%= ms.title %></h3>
						<ul class="o-members-list">

							<% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>

							<li <%= ( (i + 1) % 2 != 0 ) ? "class=odd" : '' %>>
								<div class="o-members-pic"><%= show_avatar(member) %></div>
								<ul class="o-members-info">
									<% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
									   if @job_title != 'NoData' and !@job_title.blank?
									%>
									<li><b class="o-members-label">
										<%= @job_title_field.title %></b>
										<%= @job_title %>
									</li>
									<% end %>
									<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_staff_front_end_member_staff_list_path(member.id), {:class => "o-members-link"} %></li>
									<% if !member.office_tel.blank? %>
									<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
									<% end %>
									<li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li>

									
									<% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
									   if @job_business != 'NoData' and !@job_business.blank?
									%>
									<li><b class="o-members-label">
										<%= @job_business_field.title %></b>
										<%= @job_business %>
									</li>
									<% end %>
								</ul>
							</li>

							<% end %>

						</ul>

						<% end %>

						<% end %>

					</div>

			<% end %>

				</div>
			</section>

		<% elsif @item.frontend_style == 'List' %>
					
				<% if !@member_list_categorys.blank? %>
				<ul class="o-members-nav">
				<% @member_list_categorys.each do |mc| %>
					<li class="<%= (params[:mcid] == mc.id.to_s or @mcs.to_s == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li>
				<% end %>
				</ul>
				<% end %>
				
				<div class="o-members view-ntu-lists">

						<%  @member_status.each do |ms| %>

						<% if @member_lists.where(:role_status_ids=>ms.id).count > 0  %>

						<h3 class="o-members-category h3"><%= ms.title %></h3>

						<table>
							<thead>
								<tr>
									<td><span class="job_title"><%= @job_title_field.title %></span></td>
									<td><span class="name"><%= t("users.name")%></span></td>
									<td><span class="tel"><%= t("users.office_tel")%></span></td>
									<td><span class="business"><%= @job_business_field.title %></span></td>
								</tr>
							</thead>

							<% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>
							
							<tr>
								<td>
									<span class="job_title">
									<% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
									   if @job_title != 'NoData' and !@job_title.blank?
									%>
									<%= @job_title %>
									<% end %>
									</span>
								</td>
								<td><span class="name"><%= link_to member.name, "mailto:#{member.email}" %></span></td>
								<% if !member.office_tel.blank? %>
								<td><span class="tel"><%= member.office_tel %></span></td>
								<% end %>
								<td>
									<span class="business">
									<% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
									   if @job_business != 'NoData' and !@job_business.blank?
									%>
									<%= @job_business %>
									<% end %>
									</span>
								</td>
							</tr>
							
							<% end %>

						</table>
						
						<% end %>

						<% end %>

				</div>

		<% end %>

<% end %>

<%= stylesheet_link_tag "member_staff/members" %>
