{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository">
	{{template "repo/header" .}}
	<div class="ui container">
		<h4 class="ui top attached header">
			{{svg "octicon-pencil" 16}} {{ctx.Locale.Tr "repo.licenses.edit_key"}}
		</h4>
		<div class="ui attached segment">
			<div class="tw-mb-4">
				<strong>{{ctx.Locale.Tr "repo.licenses.key_prefix"}}:</strong> <code>{{.Key.KeyPrefix}}</code>
			</div>
			<form class="ui form" method="post" action="{{.FormAction}}">
				{{.CsrfTokenHtml}}
				<div class="two fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.licensee_name"}}</label>
						<input name="licensee_name" value="{{.Key.LicenseeName}}" placeholder="Customer name">
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.licensee_email"}}</label>
						<input name="licensee_email" type="email" value="{{.Key.LicenseeEmail}}" placeholder="customer@example.com">
					</div>
				</div>
				<div class="two fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.domain_restriction"}}</label>
						<input name="domain_restriction" value="{{.Key.DomainRestriction}}" placeholder="example.com,example.org">
						<p class="help">{{ctx.Locale.Tr "repo.licenses.domain_restriction_help"}}</p>
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.max_sites"}}</label>
						<input name="max_sites" type="number" value="{{.Key.MaxSites}}" min="0">
						<p class="help">0 = {{ctx.Locale.Tr "repo.licenses.use_package_default"}}</p>
					</div>
				</div>
				<div class="field">
					<label>{{ctx.Locale.Tr "repo.licenses.expires_at"}}</label>
					<input name="expires_at" type="date" value="{{.ExpiresDate}}">
					<p class="help">{{ctx.Locale.Tr "repo.licenses.expires_at_help"}}</p>
				</div>
				<div class="field">
					<div class="ui checkbox">
						<input name="is_active" type="checkbox" {{if .Key.IsActive}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.licenses.active"}}</label>
					</div>
					<p class="help">{{ctx.Locale.Tr "repo.licenses.active_help_key"}}</p>
				</div>
				<div class="field tw-mt-4">
					<button class="ui primary button" type="submit">{{ctx.Locale.Tr "save"}}</button>
					<a class="ui button" href="{{.BackLink}}">{{ctx.Locale.Tr "cancel"}}</a>
				</div>
			</form>
		</div>
	</div>
</div>
{{template "base/footer" .}}
