{{template "repo/settings/layout_head" (dict "pageClass" "repository settings licensing")}}
	<div class="user-main-content twelve wide column">
		<h4 class="ui top attached header">
			{{svg "octicon-broadcast" 16}} {{ctx.Locale.Tr "repo.settings.licensing_section"}}
		</h4>
		<div class="ui attached segment">
			<form class="ui form" method="post" action="{{.Link}}">
				<input type="hidden" name="action" value="licensing">

				<div class="inline field">
					<div class="ui checkbox">
						<input name="enable_licensing" type="checkbox" {{if and .RepoUpdateConfig .RepoUpdateConfig.LicensingEnabled}}checked{{end}}>
						<label><strong>{{ctx.Locale.Tr "repo.settings.enable_licensing"}}</strong></label>
					</div>
					<p class="help">{{ctx.Locale.Tr "repo.settings.licensing_section_desc"}}</p>
				</div>

				<div class="ui divider"></div>

				<div class="inline field">
					<label>{{ctx.Locale.Tr "repo.settings.update_platform"}}</label>
					<select name="update_platform" class="ui dropdown">
						<option value="joomla" {{if or (not .RepoUpdateConfig) (eq .RepoUpdateConfig.Platform "joomla") (eq .RepoUpdateConfig.Platform "")}}selected{{end}}>Joomla (updates.xml)</option>
						<option value="dolibarr" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "dolibarr")}}selected{{end}}>Dolibarr (JSON)</option>
						<option value="wordpress" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "wordpress")}}selected{{end}}>WordPress (JSON)</option>
						<option value="composer" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "composer")}}selected{{end}}>Composer (packages.json)</option>
						<option value="prestashop" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "prestashop")}}selected{{end}}>PrestaShop</option>
						<option value="drupal" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "drupal")}}selected{{end}}>Drupal</option>
						<option value="both" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.Platform "both")}}selected{{end}}>{{ctx.Locale.Tr "repo.settings.update_platform_both"}}</option>
					</select>
					<p class="help">{{ctx.Locale.Tr "repo.settings.update_platform_help"}}</p>
				</div>

				{{if and .RepoUpdateConfig (ne .RepoUpdateConfig.Platform "joomla") (ne .RepoUpdateConfig.Platform "both") (ne .RepoUpdateConfig.Platform "")}}
				<div class="inline field">
					<div class="ui checkbox">
						<input name="require_update_key" type="checkbox" {{if .RepoUpdateConfig.RequireKey}}checked{{end}}>
						<label>{{ctx.Locale.Tr "repo.settings.require_update_key"}}</label>
					</div>
					<p class="help">{{ctx.Locale.Tr "repo.settings.require_update_key_help"}}</p>
				</div>
				{{end}}

				<div class="inline field">
					<label>{{ctx.Locale.Tr "repo.settings.download_gating"}}</label>
					<select name="download_gating" class="ui dropdown">
						<option value="none" {{if or (not .RepoUpdateConfig) (eq .RepoUpdateConfig.DownloadGating "") (eq .RepoUpdateConfig.DownloadGating "none")}}selected{{end}}>{{ctx.Locale.Tr "org.settings.download_gating_none"}}</option>
						<option value="prerelease" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.DownloadGating "prerelease")}}selected{{end}}>{{ctx.Locale.Tr "org.settings.download_gating_prerelease"}}</option>
						<option value="all" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.DownloadGating "all")}}selected{{end}}>{{ctx.Locale.Tr "org.settings.download_gating_all"}}</option>
					</select>
					<p class="help">{{ctx.Locale.Tr "org.settings.download_gating_help"}}</p>
				</div>

				<div class="inline field">
					<label>{{ctx.Locale.Tr "repo.settings.support_url"}}</label>
					<input name="support_url" value="{{if .RepoUpdateConfig}}{{.RepoUpdateConfig.SupportURL}}{{end}}" placeholder="https://mokoconsulting.tech/support">
					<p class="help">{{ctx.Locale.Tr "repo.settings.support_url_help"}}</p>
				</div>

				<div class="ui divider"></div>
				<h5>{{ctx.Locale.Tr "repo.settings.extension_metadata"}}</h5>
				<p class="help tw-mb-4">{{ctx.Locale.Tr "repo.settings.extension_metadata_desc"}}</p>

				<div class="two fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "org.settings.extension_name"}}</label>
						<input name="extension_name" value="{{if .RepoUpdateConfig}}{{.RepoUpdateConfig.ExtensionName}}{{end}}" placeholder="pkg_myextension">
						<p class="help">{{ctx.Locale.Tr "org.settings.extension_name_help"}}</p>
					</div>
				</div>
				<div class="two fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "org.settings.extension_type"}}</label>
						<select name="extension_type" class="ui dropdown">
							<option value="">{{ctx.Locale.Tr "repo.settings.inherit_org"}}</option>
							<option value="package" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "package")}}selected{{end}}>Package</option>
							<option value="component" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "component")}}selected{{end}}>Component</option>
							<option value="module" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "module")}}selected{{end}}>Module</option>
							<option value="plugin" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "plugin")}}selected{{end}}>Plugin</option>
							<option value="template" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "template")}}selected{{end}}>Template</option>
							<option value="library" {{if and .RepoUpdateConfig (eq .RepoUpdateConfig.ExtensionType "library")}}selected{{end}}>Library</option>
						</select>
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "org.settings.target_version"}}</label>
						<input name="target_version" value="{{if .RepoUpdateConfig}}{{.RepoUpdateConfig.TargetVersion}}{{end}}" placeholder="(5|6)\..*">
						<p class="help">{{ctx.Locale.Tr "org.settings.target_version_help"}}</p>
					</div>
				</div>
				<div class="two fields">
					<div class="field">
						<label>{{ctx.Locale.Tr "org.settings.maintainer"}}</label>
						<input name="maintainer" value="{{if .RepoUpdateConfig}}{{.RepoUpdateConfig.Maintainer}}{{end}}" placeholder="Moko Consulting">
					</div>
					<div class="field">
						<label>{{ctx.Locale.Tr "org.settings.php_minimum"}}</label>
						<input name="php_minimum" value="{{if .RepoUpdateConfig}}{{.RepoUpdateConfig.PHPMinimum}}{{end}}" placeholder="8.1">
					</div>
				</div>

				<div class="field">
					<button class="ui primary button">{{ctx.Locale.Tr "save"}}</button>
				</div>
			</form>
		</div>
	</div>
{{template "repo/settings/layout_footer" .}}
