<% site_server = @site_construct.site_server %>
<% if @site_certs.count == 0 %>
	<% if (site_server.has_certbot rescue false)%>
		<div class="control-group">
			<label style=" font-size: 1.2em; font-weight: bold; ">
				<%= check_box_tag("redirect_to_https",1,(@site_construct.redirect_to_https rescue false)) %>
				<%=t("client_management.redirect_to_https")%>
			</label>
		</div>
		<table class="table table-bordered main-list default">
			<thead>
				<th></th>
				<th><%=t('client_management.upload_date')%></th>
				<th><%=t('client_management.start_date')%>/<%=t('client_management.end_date')%></th>
	      		<th><%=t('client_management.domain_name')%></th>
			</thead>
			<tbody>
				<tr>
					<td><%=radio_button_tag("site_cert","certbot",false)%></td>
					<td>Certbot</td>
					<td></td>
	    			<td></td>
				</tr>
			</tbody>
		</table>
	<% else %>
		<a href="<%=admin_site_panel_server_manager_path%>">Please install certbot first!</a>
		<div style="clear: both;"></div>
	<% end %>
	<%= link_to t('client_management.upload_cert'),upload_cert_admin_site_panel_index_path, :target=>"_blank" %>
<% else %>
	<div class="control-group">
		<label style=" font-size: 1.2em; font-weight: bold; ">
			<%= check_box_tag("redirect_to_https",1,(@site_construct.redirect_to_https rescue false)) %>
			<%=t("client_management.redirect_to_https")%>
		</label>
	</div>
	<table class="table table-bordered main-list default">
		<thead>
			<th></th>
			<th><%=t('client_management.upload_date')%></th>
			<th><%=t('client_management.start_date')%>/<%=t('client_management.end_date')%></th>
      		<th><%=t('client_management.domain_name')%></th>
		</thead>
		<tbody>
			<% if (site_server.has_certbot rescue false)%>
			<tr>
				<td><%=radio_button_tag("site_cert","certbot",false)%></td>
				<td>Certbot</td>
				<td></td>
    			<td></td>
			</tr>
			<% end %>
			<% @site_certs.each do |site_cert| %>
				<tr>
					<td><%=radio_button_tag("site_cert",site_cert.id,site_cert.id == @enable_cert_id)%></td>
					<td><%=site_cert.upload_date %><%= '(certbot)' if site_cert.is_certbot%></td>
					<td><%=site_cert.display_start_date %> / <%=site_cert.display_end_date %></td>
        			<td><%=site_cert.display_domain_names %></td>
				</tr>
			<% end %>
		</tbody>
	</table>
<% end %>