<template name="adminImportPrepare">
	<section class="page-container page-home page-static page-settings">
		{{#with importer}}
			{{> header sectionName=name}}
			<div class="content">
				{{#unless isAdmin}}
					<p>{{_ "You_are_not_authorized_to_view_this_page"}}</p>
				{{else}}
					<div class="rocket-form">
						<fieldset>
							{{#each warnings}}
								<div class="section">
									<h1>{{_ "Warnings"}}</h1>
									<div class="section-content">
										<p style="color: #bc2031;">{{_ text}} <a href="{{href}}" target="_blank">{{href}}</a></p>
									</div>
								</div>
							{{/each}}

							{{#if isLoaded}}
								<div class="section">
									<h1>{{_ "Actions"}}</h1>
									<div class="section-content">
										<button class="button uncheck-deleted-users"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Deleted_Users"}}</span></button>
										<button class="button uncheck-archived-channels"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Archived_Channels"}}</span></button>
										<button class="button restart"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Restart_Import"}}</span></button>
										<button class="button primary start"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Start_Import"}}</span></button>
									</div>
								</div>

								{{#if users.length}}
									<div class="section">
										<h1>{{_ "Users"}}</h1>
										<div class="section-content">
											<ul>
												{{#each users}}
													{{#unless is_bot}}
														<li>
															<input type="checkbox" name="{{user_id}}" checked="checked" />{{username}} - {{email}}
															{{#if is_deleted }} <em>({{_ "Deleted"}})</em>{{/if}}
														</li>
													{{/unless}}
												{{/each}}
											</ul>
										</div>
									</div>
								{{/if}}

								{{#if channels.length}}
									<div class="section">
										<h1>{{_ "Channels"}}</h1>
										<div class="section-content">
											<ul>
												{{#each channels}}
													<li>
														<input type="checkbox" name="{{channel_id}}" checked="checked" />{{name}}
														{{#if is_archived}} <em>({{_ "Importer_Archived"}})</em>{{/if}}
														{{#if is_private}} <em>({{_ "Private_Group"}})</em>{{/if}}
													</li>
												{{/each}}
											</ul>
										</div>
									</div>
								{{/if}}

								<div class="section">
									<h1>{{_ "Messages"}}: {{message_count}}</h1>
								</div>
							{{else}}
								{{#if isPreparing}}
									{{> loading}}
								{{else}}
									<div class="section">
										<h1>{{_ "Importer_Source_File"}}</h1>
										<div class="section-content">
											<input type="file" class="import-file-input">
										</div>
									</div>
								{{/if}}
							{{/if}}
						</fieldset>
					</div>
				{{/unless}}
			</div>
		{{/with}}
	</section>
</template>
