{{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_package"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" method="post" action="{{.RepoLink}}/licenses/packages/{{.Package.ID}}/edit">
				{{.CsrfTokenHtml}}
				<div class="two fields">
					<div class="required field">
						<label>{{ctx.Locale.Tr "repo.licenses.package_name"}}</label>
						<input name="name" required value="{{.Package.Name}}">
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.description"}}</label>
						<input name="description" value="{{.Package.Description}}">
					</div>
				</div>
				<div class="three fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.duration"}} ({{ctx.Locale.Tr "repo.licenses.days"}})</label>
						<input name="duration_days" type="number" value="{{.Package.DurationDays}}" min="0">
						<p class="help">0 = {{ctx.Locale.Tr "repo.licenses.lifetime"}}</p>
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.max_sites"}}</label>
						<input name="max_sites" type="number" value="{{.Package.MaxSites}}" min="0">
						<p class="help">0 = {{ctx.Locale.Tr "repo.licenses.unlimited"}}</p>
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "repo.licenses.domain_lock_hours"}}</label>
						<input name="domain_lock_hours" type="number" value="{{.Package.DomainLockHours}}" min="0">
						<p class="help">{{ctx.Locale.Tr "repo.licenses.domain_lock_hours_help"}}</p>
					</div>
					<div class="field">
						{{template "shared/combolist" dict "Name" "allowed_channels" "Title" (ctx.Locale.Tr "repo.licenses.channels") "Items" $.ChannelItems "SelectedValues" $.SelectedChannelValues "EmptyText" (ctx.Locale.Tr "repo.licenses.all_channels") "Icon" "octicon-tag"}}
						<p class="help">{{ctx.Locale.Tr "repo.licenses.channels_help"}}</p>
					</div>
				</div>
				<div class="field">
					<label>{{ctx.Locale.Tr "repo.licenses.domain_restriction"}}</label>
					<input name="domain_restriction" value="{{.Package.DomainRestriction}}" placeholder="example.com, example.org">
					<p class="help">{{ctx.Locale.Tr "repo.licenses.domain_restriction_package_help"}}</p>
				</div>
				<div class="field">
					<div class="ui checkbox">
						<input name="is_active" type="checkbox" {{if .Package.IsActive}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.licenses.active"}}</label>
					</div>
					<p class="help">{{ctx.Locale.Tr "repo.licenses.active_help_package"}}</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="{{.RepoLink}}/licenses">{{ctx.Locale.Tr "cancel"}}</a>
				</div>
			</form>
		</div>
	</div>
</div>
{{template "base/footer" .}}
