{{if .Flash}}
{{template "base/alert" .}}
{{end}}
<form class="issue-content ui comment form form-fetch-action" id="new-issue" action="{{.Link}}" method="post">
	{{.CsrfTokenHtml}}
	<div class="issue-content-left">
		<div class="ui comments">
			<div class="comment">
				{{ctx.AvatarUtils.Avatar .SignedUser 40}}
				<div class="ui segment content tw-my-0">
					<div class="field">
						<input name="title" class="js-autofocus-end" id="issue_title" placeholder="{{ctx.Locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" required maxlength="255" autocomplete="off">
						{{if .PageIsComparePull}}
							<div class="title_wip_desc" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}">{{ctx.Locale.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0)}}</div>
						{{end}}
					</div>
					{{if .Fields}}
						<input type="hidden" name="template-file" value="{{.TemplateFile}}">
						{{range .Fields}}
							{{if eq .Type "input"}}
								{{template "repo/issue/fields/input" dict "item" .}}
							{{else if eq .Type "markdown"}}
								{{template "repo/issue/fields/markdown" dict "item" .}}
							{{else if eq .Type "textarea"}}
								{{template "repo/issue/fields/textarea" dict "item" . "root" $}}
							{{else if eq .Type "dropdown"}}
								{{template "repo/issue/fields/dropdown" dict "item" .}}
							{{else if eq .Type "checkboxes"}}
								{{template "repo/issue/fields/checkboxes" dict "item" .}}
							{{end}}
						{{end}}
					{{else}}
						{{template "repo/issue/comment_tab" .}}
					{{end}}
					<div class="text right">
						<button class="ui primary button">
							{{if .PageIsComparePull}}
								{{ctx.Locale.Tr "repo.pulls.create"}}
							{{else}}
								{{ctx.Locale.Tr "repo.issues.create"}}
							{{end}}
						</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="issue-content-right ui segment">
		{{template "repo/issue/branch_selector_field" $}}{{/* TODO: RemoveIssueRef: template "repo/issue/branch_selector_field" $*/}}

		{{if .PageIsComparePull}}
			{{template "repo/issue/sidebar/reviewer_list" $.IssuePageMetaData}}
			<div class="divider"></div>
		{{end}}

		{{template "repo/issue/sidebar/label_list" $.IssuePageMetaData}}
		{{template "repo/issue/sidebar/milestone_list" $.IssuePageMetaData}}
		{{if .IsProjectsEnabled}}
			{{template "repo/issue/sidebar/project_list" $.IssuePageMetaData}}
		{{end}}
		{{template "repo/issue/sidebar/assignee_list" $.IssuePageMetaData}}

		{{if and .PageIsComparePull (not (eq .HeadRepo.FullName .BaseCompareRepo.FullName)) .CanWriteToHeadRepo}}
			<div class="divider"></div>
			<div class="ui checkbox">
				<label data-tooltip-content="{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers_desc"}}"><strong>{{ctx.Locale.Tr "repo.pulls.allow_edits_from_maintainers"}}</strong></label>
				<input name="allow_maintainer_edit" type="checkbox" {{if .AllowMaintainerEdit}}checked{{end}}>
			</div>
		{{end}}
	</div>
	<input type="hidden" name="redirect_after_creation" value="{{.redirect_after_creation}}">
</form>
