<!--
Copyright (C) 2024 Nicola Murino

This WebUI uses the KeenThemes Bootstrap Templates:

https://keenthemes.com/bootstrap-templates

KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.

This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
-->
{{- define "fshtml"}}
<div class="card mt-10 {{if .IsHidden}}d-none{{end}}">
    <div class="card-header bg-light">
        <h3 data-i18n="storage.title" class="card-title section-title-inner">File system</h3>
    </div>
    <div class="card-body">
        <div class="form-group row">
            <label for="idFilesystem" data-i18n="storage.label" class="col-md-3 col-form-label">Storage</label>
            <div class="col-md-9">
                <select id="idFilesystem" name="fs_provider" class="form-select" data-control="i18n-select2" data-hide-search="true">
                    <option value="0" data-i18n="storage.local" {{if eq .Provider 0 }}selected{{end}}>Local</option>
                    <option value="4" data-i18n="storage.encrypted" {{if eq .Provider 4 }}selected{{end}}>Local encrypted</option>
                    <option value="1" data-i18n="storage.s3" {{if eq .Provider 1 }}selected{{end}}>AWS S3 (Compatible)</option>
                    <option value="2" data-i18n="storage.gcs" {{if eq .Provider 2 }}selected{{end}}>Google Cloud Storage</option>
                    <option value="3" data-i18n="storage.azblob" {{if eq .Provider 3 }}selected{{end}}>Azure Blob Storage</option>
                    <option value="5" data-i18n="storage.sftp" {{if eq .Provider 5 }}selected{{end}}>SFTP</option>
                    <option value="6" data-i18n="storage.http" {{if eq .Provider 6 }}selected{{end}}>HTTP</option>
                </select>
            </div>
        </div>
        {{- if or .IsUserPage .IsGroupPage}}
        <div class="form-group row mt-10">
            <label for="idHomeDir" data-i18n="storage.home_dir" class="col-md-3 col-form-label">Home Dir</label>
            <div class="col-md-9">
                <input id="idHomeDir" type="text" data-i18n="[placeholder]storage.home_dir_placeholder" class="form-control" name="home_dir" value="{{.DirPath}}" aria-describedby="idHomeDirHelp" />
                <div id="idHomeDirHelp" class="form-text" {{if not .DirPath}}{{if .HasUsersBaseDir}}data-i18n="storage.home_dir_help1"{{else}}{{if .IsGroupPage}}data-i18n="storage.home_dir_help2"{{else}}data-i18n="storage.home_dir_help3"{{end}}{{end}}{{end}}></div>
            </div>
        </div>
        {{- else}}
        <div class="form-group row mt-10">
            <label for="idMappedPath" data-i18n="storage.home_dir" class="col-md-3 col-form-label">Home Dir</label>
            <div class="col-md-9">
                <input id="idMappedPath" type="text" data-i18n="[placeholder]storage.home_dir_placeholder" class="form-control" name="mapped_path" value="{{.DirPath}}" aria-describedby="idMappedPathHelp" />
                <div id="idMappedPathHelp" class="form-text" {{if not .DirPath}}{{if .HasUsersBaseDir}}data-i18n="storage.home_dir_help1"{{else}}{{if .IsGroupPage}}data-i18n="storage.home_dir_help2"{{else}}data-i18n="storage.home_dir_help3"{{end}}{{end}}{{end}}></div>
            </div>
        </div>
        {{- end}}
        <div class="form-group row mt-10 fsconfig-local">
            <label for="idOsReadBufferSize" data-i18n="storage.os_read_buffer" class="col-md-3 col-form-label">Read buffer (MB)</label>
            <div class="col-md-3">
                <input id="idOsReadBufferSize" type="number" min="0" max="10" class="form-control" name="osfs_read_buffer_size" value="{{.OSConfig.ReadBufferSize}}" aria-describedby="idOsReadBufferSizeHelp" />
                <div id="idOsReadBufferSizeHelp" class="form-text" data-i18n="storage.os_buffer_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idOsWriteBufferSize" data-i18n="storage.os_write_buffer" class="col-md-2 col-form-label">Write buffer (MB)</label>
            <div class="col-md-3">
                <input id="idOsWriteBufferSize" type="number" min="0" max="10" class="form-control" name="osfs_write_buffer_size" value="{{.OSConfig.WriteBufferSize}}" aria-describedby="idOsWriteBufferSizeHelp" />
                <div id="idOsWriteBufferSizeHelp" class="form-text" data-i18n="storage.os_buffer_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3Bucket" data-i18n="storage.bucket" class="col-md-3 col-form-label">Bucket</label>
            <div class="col-md-9">
                <input id="idS3Bucket" type="text" class="form-control" name="s3_bucket" value="{{.S3Config.Bucket}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3Region" data-i18n="storage.region" class="col-md-3 col-form-label">Region</label>
            <div class="col-md-9">
                <input id="idS3Region" type="text" class="form-control" name="s3_region" value="{{.S3Config.Region}}" maxlength="512" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3AccessKey" data-i18n="storage.access_key" class="col-md-3 col-form-label">Access Key</label>
            <div class="col-md-9">
                <input id="idS3AccessKey" type="text" class="form-control" name="s3_access_key" value="{{.S3Config.AccessKey}}" maxlength="512" spellcheck="false" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3AccessSecret" data-i18n="storage.access_secret" class="col-md-3 col-form-label">Access Secret</label>
            <div class="col-md-9">
                <input id="idS3AccessSecret" type="password" class="form-control" name="s3_access_secret" autocomplete="new-password" spellcheck="false"
                    value="{{if .S3Config.AccessSecret.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.S3Config.AccessSecret.GetPayload}}{{end}}"/>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3KeyPrefix" data-i18n="storage.key_prefix" class="col-md-3 col-form-label">Key Prefix</label>
            <div class="col-md-9">
                <input id="idS3KeyPrefix" type="text" class="form-control" name="s3_key_prefix" value="{{.S3Config.KeyPrefix}}" aria-describedby="idS3KeyPrefixHelp"/>
                <div id="idS3KeyPrefixHelp" class="form-text" data-i18n="storage.key_prefix_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3Endpoint" data-i18n="storage.endpoint" class="col-md-3 col-form-label">Endpoint</label>
            <div class="col-md-9">
                <input id="idS3Endpoint" type="text" class="form-control" name="s3_endpoint" value="{{.S3Config.Endpoint}}" aria-describedby="idS3EndpointHelp"/>
                <div id="idS3EndpointHelp" class="form-text" data-i18n="storage.endpoint_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3RoleARN" data-i18n="storage.role_arn" class="col-md-3 col-form-label">Role ARN</label>
            <div class="col-md-9">
                <input id="idS3RoleARN" type="text" class="form-control" name="s3_role_arn" value="{{.S3Config.RoleARN}}" aria-describedby="idS3RoleARNHelp"/>
                <div id="idS3RoleARNHelp" class="form-text" data-i18n="storage.role_arn_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3StorageClass" data-i18n="storage.class" class="col-md-3 col-form-label">Storage Class</label>
            <div class="col-md-3">
                <input id="idS3StorageClass" type="text" class="form-control" name="s3_storage_class" value="{{.S3Config.StorageClass}}" aria-describedby="idS3StorageClassHelp" />
                <div id="idS3StorageClassHelp" class="form-text" data-i18n="general.blank_default_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idS3ACL" data-i18n="storage.acl" class="col-md-2 col-form-label">ACL</label>
            <div class="col-md-3">
                <input id="idS3ACL" type="text" class="form-control" name="s3_acl" value="{{.S3Config.ACL}}" aria-describedby="idS3ACLHelp" />
                <div id="idS3ACLHelp" class="form-text" data-i18n="general.blank_default_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3PartSize" data-i18n="storage.ul_part_size" class="col-md-3 col-form-label">Upload Part Size (MB)</label>
            <div class="col-md-3">
                <input id="idS3PartSize" type="number" min="0" max="5000" class="form-control" name="s3_upload_part_size" value="{{.S3Config.UploadPartSize}}" aria-describedby="idS3PartSizeHelp" />
                <div id="idS3PartSizeHelp" class="form-text" data-i18n="storage.part_size_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idS3UploadConcurrency" data-i18n="storage.ul_concurrency" class="col-md-2 col-form-label">Upload concurrency</label>
            <div class="col-md-3">
                <input id="idS3UploadConcurrency" type="number" min="0" max="64" class="form-control" name="s3_upload_concurrency" value="{{.S3Config.UploadConcurrency}}" aria-describedby="idS3UploadConcurrencyHelp" />
                <div id="idS3UploadConcurrencyHelp" class="form-text" data-i18n="storage.ul_concurrency_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3DLPartSize" data-i18n="storage.dl_part_size" class="col-md-3 col-form-label">Download Part Size (MB)</label>
            <div class="col-md-3">
                <input id="idS3DLPartSize" type="number" min="0" max="5000" class="form-control" name="s3_download_part_size" value="{{.S3Config.DownloadPartSize}}" aria-describedby="idS3DLPartSizeHelp" />
                <div id="idS3DLPartSizeHelp" class="form-text" data-i18n="storage.part_size_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idS3DownloadConcurrency" data-i18n="storage.dl_concurrency" class="col-md-2 col-form-label">Download concurrency</label>
            <div class="col-md-3">
                <input id="idS3DownloadConcurrency" type="number" min="0" max="64" class="form-control" name="s3_download_concurrency" value="{{.S3Config.DownloadConcurrency}}" aria-describedby="idS3DownloadConcurrencyHelp" />
                <div id="idS3DownloadConcurrencyHelp" class="form-text" data-i18n="storage.dl_concurrency_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3UploadTimeout" data-i18n="storage.ul_part_timeout" class="col-md-3 col-form-label">UL Part Timeout (secs)</label>
            <div class="col-md-3">
                <input id="idS3UploadTimeout" type="number" min="0" class="form-control" name="s3_upload_part_max_time" value="{{.S3Config.UploadPartMaxTime}}" aria-describedby="idS3UploadTimeoutHelp" />
                <div id="idS3UploadTimeoutHelp" class="form-text" data-i18n="storage.ul_part_timeout_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idS3DownloadTimeout" data-i18n="storage.dl_part_timeout" class="col-md-2 col-form-label">DL Part Timeout (secs)</label>
            <div class="col-md-3">
                <input id="idS3DownloadTimeout" type="number" min="0" class="form-control" name="s3_download_part_max_time" value="{{.S3Config.DownloadPartMaxTime}}" aria-describedby="idS3DownloadTimeoutHelp" />
                <div id="idS3DownloadTimeoutHelp" class="form-text" data-i18n="storage.dl_part_timeout_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-s3">
            <label for="idS3SSECustomerKey" data-i18n="storage.sse_customer_key" class="col-md-3 col-form-label">SSE Customer Key</label>
            <div class="col-md-9">
                <input id="idS3SSECustomerKey" type="password" class="form-control" name="s3_sse_customer_key" autocomplete="new-password" spellcheck="false"
                    value="{{if .S3Config.SSECustomerKey.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.S3Config.SSECustomerKey.GetPayload}}{{end}}" aria-describedby="idS3SSECustomerKeyHelp"/>
                <div id="idS3SSECustomerKeyHelp" class="form-text" data-i18n="storage.sse_customer_key_help"></div>
            </div>
        </div>

        <div class="form-group row align-items-center mt-10 fsconfig-s3">
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idS3ForcePathStyle" name="s3_force_path_style" {{if .S3Config.ForcePathStyle}}checked{{end}}/>
                    <label data-i18n="storage.s3_path_style" class="form-check-label fw-semibold text-gray-800" for="idS3ForcePathStyle">
                        Use path-style addressing, i.e., "`endpoint`/BUCKET/KEY"
                    </label>
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idS3SkipTLSVerify" name="s3_skip_tls_verify" {{if .S3Config.SkipTLSVerify}}checked{{end}}/>
                    <label data-i18n="general.skip_tls_verify" class="form-check-label fw-semibold text-gray-800" for="idS3SkipTLSVerify">
                        Skip TLS verify. This should be used only for testing
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-gcs">
            <label for="idGCSBucket" data-i18n="storage.bucket" class="col-md-3 col-form-label">Bucket</label>
            <div class="col-md-9">
                <input id="idGCSBucket" type="text" class="form-control" name="gcs_bucket" value="{{.GCSConfig.Bucket}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-gcs">
            <label for="idGCSCredentialFile" data-i18n="storage.credentials_file" class="col-md-3 col-form-label">Credential files</label>
            <div class="col-md-9">
                <input id="idGCSCredentialFile" type="file" accept="application/json" class="form-control" name="gcs_credential_file" aria-describedby="idGCSCredentialFileHelp" />
                <div id="idGCSCredentialFileHelp" class="form-text" data-i18n="storage.credentials_file_help"></div>
            </div>
        </div>

        <div class="form-group row align-items-center mt-10 fsconfig-gcs">
            <label data-i18n="storage.auto_credentials" class="col-md-3 col-form-label" for="idGCSAutoCredentials">Automatic credentials</label>
            <div class="col-md-9">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idGCSAutoCredentials" name="gcs_auto_credentials" {{if gt .GCSConfig.AutomaticCredentials 0}}checked{{end}}/>
                    <label data-i18n="storage.auto_credentials_help" class="form-check-label fw-semibold text-gray-800" for="idGCSAutoCredentials">
                        Use default application credentials or credentials from environment
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-gcs">
            <label for="idGCSKeyPrefix" data-i18n="storage.key_prefix" class="col-md-3 col-form-label">Key Prefix</label>
            <div class="col-md-9">
                <input id="idGCSKeyPrefix" type="text" class="form-control" name="gcs_key_prefix" value="{{.GCSConfig.KeyPrefix}}" aria-describedby="idGCSKeyPrefixHelp" />
                <div id="idGCSKeyPrefixHelp" class="form-text" data-i18n="storage.key_prefix_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-gcs">
            <label for="idGCSStorageClass" data-i18n="storage.class" class="col-md-3 col-form-label">Storage Class</label>
            <div class="col-md-3">
                <input id="idGCSStorageClass" type="text" class="form-control" name="gcs_storage_class" value="{{.GCSConfig.StorageClass}}" aria-describedby="idGCSStorageClassHelp" />
                <div id="idGCSStorageClassHelp" class="form-text" data-i18n="general.blank_default_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idGCSACL" data-i18n="storage.acl" class="col-md-2 col-form-label">ACL</label>
            <div class="col-md-3">
                <input id="idGCSACL" type="text" class="form-control" name="gcs_acl" value="{{.GCSConfig.ACL}}" aria-describedby="idGCSACLHelp"/>
                <div id="idGCSACLHelp" class="form-text" data-i18n="general.blank_default_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-gcs">
            <label for="idGCSUploadPartSize" data-i18n="storage.ul_part_size" class="col-md-3 col-form-label">Upload Part Size (MB)</label>
            <div class="col-md-3">
                <input id="idGCSUploadPartSize" type="number" min="0" class="form-control" name="gcs_upload_part_size" value="{{.GCSConfig.UploadPartSize}}" aria-describedby="idGCSUploadPartSizeHelp" />
                <div id="idGCSUploadPartSizeHelp" class="form-text" data-i18n="storage.gcs_part_size_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idGCSUploadTimeout" data-i18n="storage.ul_part_timeout" class="col-md-2 col-form-label">UL Part Timeout (secs)</label>
            <div class="col-md-3">
                <input id="idGCSUploadTimeout" type="number" min="0" class="form-control" name="gcs_upload_part_max_time" value="{{.GCSConfig.UploadPartMaxTime}}" aria-describedby="idGCSUploadTimeoutHelp" />
                <div id="idGCSUploadTimeoutHelp" class="form-text" data-i18n="storage.gcs_ul_part_timeout_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzContainer" data-i18n="storage.container" class="col-md-3 col-form-label">Container</label>
            <div class="col-md-9">
                <input id="idAzContainer" type="text" class="form-control" name="az_container" value="{{.AzBlobConfig.Container}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzAccountName" data-i18n="storage.account_name" class="col-md-3 col-form-label">Account Name</label>
            <div class="col-md-9">
                <input id="idAzAccountName" type="text" class="form-control" name="az_account_name" value="{{.AzBlobConfig.AccountName}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzAccountKey" data-i18n="storage.account_key" class="col-md-3 col-form-label">Account Key</label>
            <div class="col-md-9">
                <input id="idAzAccountKey" type="password" class="form-control" name="az_account_key" autocomplete="new-password" spellcheck="false"
                    value="{{if .AzBlobConfig.AccountKey.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.AzBlobConfig.AccountKey.GetPayload}}{{end}}"/>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzSASURL" data-i18n="storage.sas_url" class="col-md-3 col-form-label">SAS URL</label>
            <div class="col-md-9">
                <input id="idAzSASURL" type="password" class="form-control" name="az_sas_url" autocomplete="new-password" spellcheck="false" aria-describedby="idAzSASURLHelp"
                    value="{{if .AzBlobConfig.SASURL.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.AzBlobConfig.SASURL.GetPayload}}{{end}}"/>
                <div id="idAzSASURLHelp" class="form-text" data-i18n="storage.sas_url_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzKeyPrefix" data-i18n="storage.key_prefix" class="col-md-3 col-form-label">Key Prefix</label>
            <div class="col-md-9">
                <input id="idAzKeyPrefix" type="text" class="form-control" name="az_key_prefix" value="{{.AzBlobConfig.KeyPrefix}}" aria-describedby="idAzKeyPrefixHelp" />
                <div id="idAzKeyPrefixHelp" class="form-text" data-i18n="storage.key_prefix_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzAccessTier" data-i18n="storage.class" class="col-md-3 col-form-label">Storage Class</label>
            <div class="col-md-9">
                <select id="idAzAccessTier" name="az_access_tier" class="form-select" data-control="i18n-select2" data-hide-search="true">
                    <option value="" {{if eq .AzBlobConfig.AccessTier "" }}selected{{end}}>Default</option>
                    <option value="Hot" {{if eq .AzBlobConfig.AccessTier "Hot" }}selected{{end}}>Hot</option>
                    <option value="Cool" {{if eq .AzBlobConfig.AccessTier "Cool" }}selected{{end}}>Cool</option>
                    <option value="Archive" {{if eq .AzBlobConfig.AccessTier "Archive" }}selected{{end}}>Archive</option>
                </select>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzUploadPartSize" data-i18n="storage.ul_part_size" class="col-md-3 col-form-label">Upload Part Size (MB)</label>
            <div class="col-md-3">
                <input id="idAzUploadPartSize" type="number" min="0" max="100" class="form-control" name="az_upload_part_size" value="{{.AzBlobConfig.UploadPartSize}}" aria-describedby="idAzUploadPartSizeHelp" />
                <div id="idAzUploadPartSizeHelp" class="form-text" data-i18n="storage.part_size_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idAzUploadConcurrency" data-i18n="storage.ul_concurrency" class="col-md-2 col-form-label">Upload concurrency</label>
            <div class="col-md-3">
                <input id="idAzUploadConcurrency" type="number" min="0" max="64" class="form-control" name="az_upload_concurrency" value="{{.AzBlobConfig.UploadConcurrency}}" aria-describedby="idAzUploadConcurrencyHelp" />
                <div id="idAzUploadConcurrencyHelp" class="form-text" data-i18n="storage.ul_concurrency_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzDownloadPartSize" data-i18n="storage.dl_part_size" class="col-md-3 col-form-label">Download Part Size (MB)</label>
            <div class="col-md-3">
                <input id="idAzDownloadPartSize" type="number" min="0" max="100" class="form-control" name="az_download_part_size" value="{{.AzBlobConfig.DownloadPartSize}}" aria-describedby="idAzDownloadPartSizeHelp" />
                <div id="idAzDownloadPartSizeHelp" class="form-text" data-i18n="storage.part_size_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idAzDownloadConcurrency" data-i18n="storage.dl_concurrency" class="col-md-2 col-form-label">Download concurrency</label>
            <div class="col-md-3">
                <input id="idAzDownloadConcurrency" type="number" min="0" max="64" class="form-control" name="az_download_concurrency" value="{{.AzBlobConfig.DownloadConcurrency}}" aria-describedby="idAzDownloadConcurrencyHelp"/>
                <div id="idAzDownloadConcurrencyHelp" class="form-text" data-i18n="storage.dl_concurrency_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-azblob">
            <label for="idAzEndpoint" data-i18n="storage.endpoint" class="col-md-3 col-form-label">Endpoint</label>
            <div class="col-md-9">
                <input id="idAzEndpoint" type="text" class="form-control" name="az_endpoint" value="{{.AzBlobConfig.Endpoint}}" aria-describedby="idAzEndpointHelp" />
                <div id="idAzEndpointHelp" class="form-text" data-i18n="general.blank_default_help"></div>
            </div>
        </div>

        <div class="form-group row align-items-center mt-10 fsconfig-azblob">
            <label data-i18n="storage.emulator" class="col-md-3 col-form-label" for="idUseEmulator">Use Azure Blob emulator</label>
            <div class="col-md-9">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idUseEmulator" name="az_use_emulator" {{if .AzBlobConfig.UseEmulator}}checked{{end}}/>
                </div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-crypt">
            <label for="idCryptPassphrase" data-i18n="storage.passphrase" class="col-md-3 col-form-label">Passphrase</label>
            <div class="col-md-9">
                <input id="idCryptPassphrase" type="password" class="form-control" name="crypt_passphrase" autocomplete="new-password" spellcheck="false" aria-describedby="idCryptPassphraseHelp"
                    value="{{if .CryptConfig.Passphrase.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.CryptConfig.Passphrase.GetPayload}}{{end}}"/>
                <div id="idCryptPassphraseHelp" class="form-text" data-i18n="storage.passphrase_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-crypt">
            <label for="idCryptFsReadBufferSize" data-i18n="storage.os_read_buffer" class="col-md-3 col-form-label">Read buffer (MB)</label>
            <div class="col-md-3">
                <input id="idCryptFsReadBufferSize" type="number" min="0" max="10" class="form-control" name="cryptfs_read_buffer_size" value="{{.CryptConfig.ReadBufferSize}}" aria-describedby="idCryptFsReadBufferSizeHelp" />
                <div id="idCryptFsReadBufferSizeHelp" class="form-text" data-i18n="storage.os_buffer_help"></div>
            </div>
            <div class="col-md-1"></div>
            <label for="idCryptFsWriteBufferSize" data-i18n="storage.os_write_buffer" class="col-md-2 col-form-label">Write buffer (MB)</label>
            <div class="col-md-3">
                <input id="idCryptFsWriteBufferSize" type="number" min="0" max="10" class="form-control" name="cryptfs_write_buffer_size" value="{{.CryptConfig.WriteBufferSize}}" aria-describedby="idCryptFsWriteBufferSizeHelp" />
                <div id="idCryptFsWriteBufferSizeHelp" class="form-text" data-i18n="storage.os_buffer_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPEndpoint" data-i18n="storage.endpoint" class="col-md-3 col-form-label">Endpoint</label>
            <div class="col-md-9">
                <input id="idSFTPEndpoint" type="text" class="form-control" name="sftp_endpoint" value="{{.SFTPConfig.Endpoint}}" aria-describedby="idSFTPEndpointHelp"/>
                <div id="idSFTPEndpointHelp" class="form-text" data-i18n="storage.sftp_endpoint_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPUsername" data-i18n="login.username" class="col-md-3 col-form-label">Username</label>
            <div class="col-md-9">
                <input id="idSFTPUsername" type="text" class="form-control" name="sftp_username" value="{{.SFTPConfig.Username}}" spellcheck="false" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPPassword" data-i18n="login.password" class="col-md-3 col-form-label">Password</label>
            <div class="col-md-9">
                <input id="idSFTPPassword" type="password" class="form-control" name="sftp_password" autocomplete="new-password" spellcheck="false"
                    value="{{if .SFTPConfig.Password.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.SFTPConfig.Password.GetPayload}}{{end}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPPrivateKey" data-i18n="general.private_key" class="col-md-3 col-form-label">Private key</label>
            <div class="col-md-9">
                <textarea class="form-control" id="idSFTPPrivateKey" name="sftp_private_key" spellcheck="false"
                    rows="3">{{if .SFTPConfig.PrivateKey.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.SFTPConfig.PrivateKey.GetPayload}}{{end}}</textarea>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPPassphrase" data-i18n="storage.passphrase" class="col-md-3 col-form-label">Passphrase</label>
            <div class="col-md-9">
                <input id="idSFTPPassphrase" type="password" class="form-control" name="sftp_key_passphrase" autocomplete="new-password" spellcheck="false" aria-describedby="idSFTPPassphraseHelp"
                    value="{{if .SFTPConfig.KeyPassphrase.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.SFTPConfig.KeyPassphrase.GetPayload}}{{end}}" />
                <div id="idSFTPPassphraseHelp" class="form-text" data-i18n="storage.passphrase_key_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPPrefix" data-i18n="storage.sftp_home_dir" class="col-md-3 col-form-label">Root directory</label>
            <div class="col-md-9">
                <input id="idSFTPPrefix" type="text" class="form-control" name="sftp_prefix" value="{{.SFTPConfig.Prefix}}" aria-describedby="idSFTPPrefixHelp"/>
                <div id="idSFTPPrefixHelp" class="form-text" data-i18n="storage.sftp_home_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPFingerprints" data-i18n="storage.fingerprints" class="col-md-3 col-form-label">Fingerprints</label>
            <div class="col-md-9">
                <textarea class="form-control" id="idSFTPFingerprints" name="sftp_fingerprints" spellcheck="false" aria-describedby="idSFTPFingerprintsHelp"
                    rows="3">{{- range .SFTPConfig.Fingerprints}}{{.}}&#010;{{- end}}</textarea>
                <div id="idSFTPFingerprintsHelp" class="form-text" data-i18n="storage.fingerprints_help"></div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-sftp">
            <label for="idSFTPUploadBufferSize" data-i18n="storage.sftp_buffer" class="col-md-3 col-form-label">Buffer size (MB)</label>
            <div class="col-md-9">
                <input id="idSFTPUploadBufferSize" type="number" min="0" max="16" class="form-control" name="sftp_buffer_size" value="{{.SFTPConfig.BufferSize}}" aria-describedby="idSFTPUploadBufferSizeHelp" />
                <div id="idSFTPUploadBufferSizeHelp" class="form-text" data-i18n="storage.os_buffer_help"></div>
            </div>
        </div>

        <div class="form-group row align-items-center mt-10 fsconfig-sftp">
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idDisableConcurrentReads" name="sftp_disable_concurrent_reads" {{if .SFTPConfig.DisableCouncurrentReads}}checked{{end}}/>
                    <label data-i18n="storage.sftp_concurrent_reads" class="form-check-label fw-semibold text-gray-800" for="idDisableConcurrentReads">
                        Disable concurrent reads
                    </label>
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idSFTPEqualityCheckMode" name="sftp_equality_check_mode" {{if eq .SFTPConfig.EqualityCheckMode 1}}checked{{end}}/>
                    <label data-i18n="storage.relaxed_equality_check" class="form-check-label fw-semibold text-gray-800" for="idSFTPEqualityCheckMode">
                        Relaxed equality check
                    </label>
                </div>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-http">
            <label for="idHTTPEndpoint" data-i18n="storage.endpoint" class="col-md-3 col-form-label">Endpoint</label>
            <div class="col-md-9">
                <input id="idHTTPEndpoint" type="text" class="form-control" name="http_endpoint" value="{{.HTTPConfig.Endpoint}}"/>
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-http">
            <label for="idHTTPUsername" data-i18n="login.username" class="col-md-3 col-form-label">Username</label>
            <div class="col-md-9">
                <input id="idHTTPUsername" type="text" class="form-control" name="http_username" value="{{.HTTPConfig.Username}}" spellcheck="false" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-http">
            <label for="idHTTPPassword" data-i18n="login.password" class="col-md-3 col-form-label">Password</label>
            <div class="col-md-9">
                <input id="idHTTPPassword" type="password" class="form-control" name="http_password" autocomplete="new-password" spellcheck="false"
                    value="{{if .HTTPConfig.Password.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.HTTPConfig.Password.GetPayload}}{{end}}" />
            </div>
        </div>

        <div class="form-group row mt-10 fsconfig-http">
            <label for="idHTTPAPIKey" data-i18n="storage.api_key" class="col-md-3 col-form-label">API Key</label>
            <div class="col-md-9">
                <input id="idHTTPAPIKey" type="password" class="form-control" name="http_api_key" autocomplete="new-password" spellcheck="false"
                    value="{{if .HTTPConfig.APIKey.IsEncrypted}}{{.RedactedSecret}}{{else}}{{.HTTPConfig.APIKey.GetPayload}}{{end}}" />
            </div>
        </div>

        <div class="form-group row align-items-center mt-10 fsconfig-http">
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idHTTPSkipTLSVerify" name="http_skip_tls_verify" {{if .HTTPConfig.SkipTLSVerify}}checked{{end}} />
                    <label data-i18n="general.skip_tls_verify" class="form-check-label fw-semibold text-gray-800" for="idHTTPSkipTLSVerify">
                        Skip TLS verify. This should be used only for testing
                    </label>
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-5">
                <div class="form-check form-switch form-check-custom form-check-solid">
                    <input class="form-check-input" type="checkbox" id="idHTTPEqualityCheckMode" name="http_equality_check_mode" {{if eq .HTTPConfig.EqualityCheckMode 1}}checked{{end}}/>
                    <label data-i18n="storage.relaxed_equality_check" class="form-check-label fw-semibold text-gray-800" for="idHTTPEqualityCheckMode">
                        Relaxed equality check
                    </label>
                </div>
            </div>
        </div>

    </div>
</div>
{{- end}}

{{- define "user_group_perms"}}
<div class="card mt-10">
    <div class="card-header bg-light">
        <h3 data-i18n="filters.directory_patterns" class="card-title section-title-inner">Per-directory name patterns restrictions</h3>
    </div>
    <div class="card-body">
        <div id="directory_patterns">
            {{- template "infomsg-no-mb" "filters.directory_patterns_help"}}
            <div class="form-group">
                <div data-repeater-list="directory_patterns">
                    {{- range $idx, $pattern := .GetFlatFilePatterns -}}
                    <div data-repeater-item>
                        <div class="form-group row">
                            <div class="col-md-4 mt-3 mt-md-8">
                                <input data-i18n="[placeholder]filters.directory_path_help" type="text" class="form-control" name="pattern_path" value="{{$pattern.Path}}" />
                            </div>
                            <div class="col-md-3 mt-3 mt-md-8">
                                <input type="text" class="form-control" name="patterns" placeholder="*.png,*.zip" value="{{$pattern.GetCommaSeparatedPatterns}}" />
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <select name="pattern_type" class="form-select select-repetear select-first" data-hide-search="true">
                                    <option value="denied" data-i18n="general.denied" {{- if $pattern.IsDenied}} selected{{- end}}>Denied</option>
                                    <option value="allowed" data-i18n="general.allowed" {{- if $pattern.IsAllowed}} selected{{- end}}>Allowed</option>
                                </select>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <select name="pattern_policy" class="form-select select-repetear select-first" data-hide-search="true">
                                    <option value="0" data-i18n="general.visible" {{- if eq $pattern.DenyPolicy 0}} selected{{- end}}>Visible</option>
                                    <option value="1" data-i18n="general.hidden" {{- if eq $pattern.DenyPolicy 1}} selected{{- end}}>Hidden</option>
                                </select>
                            </div>
                            <div class="col-md-1 mt-3 mt-md-8">
                                <a href="#" data-repeater-delete
                                    class="btn btn-light-danger ps-5 pe-4">
                                    <i class="ki-duotone ki-trash fs-2">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                        <span class="path4"></span>
                                        <span class="path5"></span>
                                    </i>
                                </a>
                            </div>
                        </div>
                    </div>
                    {{- else}}
                    <div data-repeater-item>
                        <div class="form-group row">
                            <div class="col-md-4 mt-3 mt-md-8">
                                <input data-i18n="[placeholder]filters.directory_path_help" type="text" class="form-control" name="pattern_path" value="" />
                            </div>
                            <div class="col-md-3 mt-3 mt-md-8">
                                <input type="text" class="form-control" name="patterns" placeholder="*.png,*.zip" value="" />
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <select name="pattern_type" class="form-select select-repetear select-first" data-hide-search="true">
                                    <option value="denied" data-i18n="general.denied">Denied</option>
                                    <option value="allowed" data-i18n="general.allowed">Allowed</option>
                                </select>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <select name="pattern_policy" class="form-select select-repetear select-first" data-hide-search="true">
                                    <option value="0" data-i18n="general.visible">Visible</option>
                                    <option value="1" data-i18n="general.hidden">Hidden</option>
                                </select>
                            </div>
                            <div class="col-md-1 mt-3 mt-md-8">
                                <a href="#" data-repeater-delete
                                    class="btn btn-light-danger ps-5 pe-4">
                                    <i class="ki-duotone ki-trash fs-2">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                        <span class="path4"></span>
                                        <span class="path5"></span>
                                    </i>
                                </a>
                            </div>
                        </div>
                    </div>
                    {{- end}}
                </div>
            </div>

            <div class="form-group mt-5">
                <a href="#" data-repeater-create class="btn btn-light-primary">
                    <i class="ki-duotone ki-plus fs-3"></i>
                    <span data-i18n="general.add">Add</span>
                </a>
            </div>
        </div>
    </div>
</div>
{{- end}}

{{- define "user_group_access_time"}}
<div class="card mt-10">
    <div class="card-header bg-light">
        <h3 data-i18n="filters.access_time" class="card-title section-title-inner">Access time restrictions</h3>
    </div>
    <div class="card-body">
        <div id="access_time_restrictions">
            {{- template "infomsg-no-mb" "filters.access_time_help"}}
            <div class="form-group">
                <div data-repeater-list="access_time_restrictions">
                    {{- range $idx, $period := .AccessTime -}}
                    <div data-repeater-item>
                        <div data-repeater-item>
                            <div class="form-group row">
                                <div class="col-md-5 mt-3 mt-md-8">
                                    <select name="access_time_day_of_week" class="form-select select-repetear select-first" data-hide-search="true">
                                        <option value="0" data-i18n="general.sunday" {{- if eq $period.DayOfWeek 0}} selected{{- end}}>Sunday</option>
                                        <option value="1" data-i18n="general.monday" {{- if eq $period.DayOfWeek 1}} selected{{- end}}>Monday</option>
                                        <option value="2" data-i18n="general.tuesday" {{- if eq $period.DayOfWeek 2}} selected{{- end}}>Tuesday</option>
                                        <option value="3" data-i18n="general.wednesday" {{- if eq $period.DayOfWeek 3}} selected{{- end}}>Wednesday</option>
                                        <option value="4" data-i18n="general.thursday" {{- if eq $period.DayOfWeek 4}} selected{{- end}}>Thursday</option>
                                        <option value="5" data-i18n="general.friday" {{- if eq $period.DayOfWeek 5}} selected{{- end}}>Friday</option>
                                        <option value="6" data-i18n="general.saturday" {{- if eq $period.DayOfWeek 6}} selected{{- end}}>Saturday</option>
                                    </select>
                                </div>
                                <div class="col-md-3 mt-3 mt-md-8">
                                    <input data-i18n="[placeholder]general.start" type="text" class="form-control" name="access_time_start" value="{{$period.From}}" />
                                </div>
                                <div class="col-md-3 mt-3 mt-md-8">
                                    <input data-i18n="[placeholder]general.end" type="text" class="form-control" name="access_time_end" value="{{$period.To}}" />
                                </div>
                                <div class="col-md-1 mt-3 mt-md-8">
                                    <a href="#" data-repeater-delete
                                        class="btn btn-light-danger ps-5 pe-4">
                                        <i class="ki-duotone ki-trash fs-2">
                                            <span class="path1"></span>
                                            <span class="path2"></span>
                                            <span class="path3"></span>
                                            <span class="path4"></span>
                                            <span class="path5"></span>
                                        </i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    {{- else}}
                    <div data-repeater-item>
                        <div class="form-group row">
                            <div class="col-md-5 mt-3 mt-md-8">
                                <select name="access_time_day_of_week" class="form-select select-repetear select-first" data-hide-search="true">
                                    <option value="0" data-i18n="general.sunday">Sunday</option>
                                    <option value="1" data-i18n="general.monday">Monday</option>
                                    <option value="2" data-i18n="general.tuesday">Tuesday</option>
                                    <option value="3" data-i18n="general.wednesday">Wednesday</option>
                                    <option value="4" data-i18n="general.thursday">Thursday</option>
                                    <option value="5" data-i18n="general.friday">Friday</option>
                                    <option value="6" data-i18n="general.saturday">Saturday</option>
                                </select>
                            </div>
                            <div class="col-md-3 mt-3 mt-md-8">
                                <input data-i18n="[placeholder]general.start" type="text" class="form-control" name="access_time_start" value="" />
                            </div>
                            <div class="col-md-3 mt-3 mt-md-8">
                                <input data-i18n="[placeholder]general.end" type="text" class="form-control" name="access_time_end" value="" />
                            </div>
                            <div class="col-md-1 mt-3 mt-md-8">
                                <a href="#" data-repeater-delete
                                    class="btn btn-light-danger ps-5 pe-4">
                                    <i class="ki-duotone ki-trash fs-2">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                        <span class="path4"></span>
                                        <span class="path5"></span>
                                    </i>
                                </a>
                            </div>
                        </div>
                    </div>
                    {{- end}}
                </div>
            </div>

            <div class="form-group mt-5">
                <a href="#" data-repeater-create class="btn btn-light-primary">
                    <i class="ki-duotone ki-plus fs-3"></i>
                    <span data-i18n="general.add">Add</span>
                </a>
            </div>
        </div>
    </div>
</div>
{{- end}}

{{- define "user_group_quota"}}
<div class="form-group row mt-10">
    <label for="idQuotaSize" data-i18n="virtual_folders.quota_size" class="col-md-3 col-form-label">Quota size</label>
    <div class="col-md-3">
        <input id="idQuotaSize" type="text" class="form-control" name="quota_size" value="{{HumanizeBytes .QuotaSize}}" aria-describedby="idQuotaSizeHelp" />
        <div id="idQuotaSizeHelp" class="form-text" data-i18n="virtual_folders.quota_size_help"></div>
    </div>
    <div class="col-md-1"></div>
    <label for="idQuotaFiles" data-i18n="virtual_folders.quota_files" class="col-md-2 col-form-label">Quota files</label>
    <div class="col-md-3">
        <input id="idQuotaFiles" type="number" min="0" class="form-control" name="quota_files" value="{{.QuotaFiles}}" aria-describedby="idQuotaFilesHelp" />
        <div id="idQuotaFilesHelp" class="form-text" data-i18n="general.zero_no_limit_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idMaxUploadSize" data-i18n="filters.max_upload_size" class="col-md-3 col-form-label">Max file upload size</label>
    <div class="col-md-9">
        <input id="idMaxUploadSize" type="text" class="form-control" name="max_upload_file_size" value="{{HumanizeBytes .Filters.MaxUploadFileSize}}" aria-describedby="idMaxUploadSizeHelp" />
        <div id="idMaxUploadSizeHelp" class="form-text" data-i18n="filters.max_upload_size_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idUploadBandwidth" data-i18n="filters.upload_bandwidth" class="col-md-3 col-form-label">Bandwidth UL (KB/s)</label>
    <div class="col-md-3">
        <input id="idUploadBandwidth" type="number" min="0" class="form-control" name="upload_bandwidth" value="{{.UploadBandwidth}}" aria-describedby="idUploadBandwidthHelp" />
        <div id="idUploadBandwidthHelp" class="form-text" data-i18n="general.zero_no_limit_help"></div>
    </div>
    <div class="col-md-1"></div>
    <label for="idDownloadBandwidth" data-i18n="filters.download_bandwidth" class="col-md-2 col-form-label">Bandwidth DL (KB/s)</label>
    <div class="col-md-3">
        <input id="idDownloadBandwidth" type="number" min="0" class="form-control" name="download_bandwidth" value="{{.DownloadBandwidth}}" aria-describedby="idDownloadBandwidthHelp" />
        <div id="idDownloadBandwidthHelp" class="form-text" data-i18n="general.zero_no_limit_help"></div>
    </div>
</div>

<div class="card mt-10">
    <div class="card-header bg-light">
        <h3 data-i18n="filters.src_bandwidth_limit" class="card-title section-title-inner">Per-source bandwidth speed limits</h3>
    </div>
    <div class="card-body">
        <div id="src_bandwidth_limits">
            <div class="form-group">
                <div data-repeater-list="src_bandwidth_limits">
                    {{- range $idx, $bwLimit := .Filters.BandwidthLimits -}}
                    <div data-repeater-item>
                        <div class="form-group row">
                            <div class="col-md-7 mt-3 mt-md-8">
                                <textarea class="form-control" name="bandwidth_limit_sources" rows="4">{{$bwLimit.GetSourcesAsString}}</textarea>
                                <div class="form-text" data-i18n="general.ip_mask_help"></div>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <input type="number" min="0" class="form-control" name="upload_bandwidth_source" value="{{$bwLimit.UploadBandwidth}}" />
                                <div class="form-text" data-i18n="filters.upload_bandwidth_help"></div>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <input type="number" min="0" class="form-control" name="download_bandwidth_source" value="{{$bwLimit.DownloadBandwidth}}" />
                                <div class="form-text" data-i18n="filters.download_bandwidth_help"></div>
                            </div>
                            <div class="col-md-1 mt-3 mt-md-8">
                                <a href="#" data-repeater-delete
                                    class="btn btn-light-danger ps-5 pe-4">
                                    <i class="ki-duotone ki-trash fs-2">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                        <span class="path4"></span>
                                        <span class="path5"></span>
                                    </i>
                                </a>
                            </div>
                        </div>
                    </div>
                    {{- else}}
                    <div data-repeater-item>
                        <div class="form-group row">
                            <div class="col-md-7 mt-3 mt-md-8">
                                <textarea class="form-control" name="bandwidth_limit_sources" rows="4"></textarea>
                                <div class="form-text" data-i18n="general.ip_mask_help"></div>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <input type="number" min="0" class="form-control" name="upload_bandwidth_source" value="" />
                                <div class="form-text" data-i18n="filters.upload_bandwidth_help"></div>
                            </div>
                            <div class="col-md-2 mt-3 mt-md-8">
                                <input type="number" min="0" class="form-control" name="download_bandwidth_source" value="" />
                                <div class="form-text" data-i18n="filters.download_bandwidth_help"></div>
                            </div>
                            <div class="col-md-1 mt-3 mt-md-8">
                                <a href="#" data-repeater-delete
                                    class="btn btn-light-danger ps-5 pe-4">
                                    <i class="ki-duotone ki-trash fs-2">
                                        <span class="path1"></span>
                                        <span class="path2"></span>
                                        <span class="path3"></span>
                                        <span class="path4"></span>
                                        <span class="path5"></span>
                                    </i>
                                </a>
                            </div>
                        </div>
                    </div>
                    {{- end}}
                </div>
            </div>

            <div class="form-group mt-5">
                <a href="#" data-repeater-create class="btn btn-light-primary">
                    <i class="ki-duotone ki-plus fs-3"></i>
                    <span data-i18n="general.add">Add</span>
                </a>
            </div>
        </div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idTransferUL" data-i18n="filters.upload_data_transfer" class="col-md-3 col-form-label">Upload data transfer (MB)</label>
    <div class="col-md-3">
        <input id="idTransferUL" type="number" min="0" class="form-control" name="upload_data_transfer" value="{{.UploadDataTransfer}}" aria-describedby="idTransferULHelp" />
        <div id="idTransferULHelp" class="form-text" data-i18n="filters.upload_data_transfer_help"></div>
    </div>
    <div class="col-md-1"></div>
    <label for="idTransferDL" data-i18n="filters.download_data_transfer" class="col-md-2 col-form-label">Download data transfer (MB)</label>
    <div class="col-md-3">
        <input id="idTransferDL" type="number" min="0" class="form-control" name="download_data_transfer" value="{{.DownloadDataTransfer}}" aria-describedby="idTransferDLhHelp" />
        <div id="idTransferDLhHelp" class="form-text" data-i18n="filters.download_data_transfer_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idTransferTotal" data-i18n="filters.total_data_transfer" class="col-md-3 col-form-label">Total data transfer (MB)</label>
    <div class="col-md-9">
        <input id="idTransferTotal" type="number" min="0" class="form-control" name="total_data_transfer" value="{{.TotalDataTransfer}}" aria-describedby="idTransferTotalHelp" />
        <div id="idTransferTotalHelp" class="form-text" data-i18n="filters.total_data_transfer_help"></div>
    </div>
</div>
{{- end}}

{{- define "user_group_advanced"}}
<div class="form-group row mt-10">
    <label for="idTLSUsername" data-i18n="filters.tls_username" class="col-md-3 col-form-label">TLS username</label>
    <div class="col-md-9">
        <select id="idTLSUsername" name="tls_username" class="form-select" data-control="i18n-select2" data-hide-search="true" aria-describedby="idTLSUsernameHelp">
            <option value="" {{if or (eq .TLSUsername "None") (eq .TLSUsername "") }}selected{{end}}>---</option>
            <option value="CommonName" {{if eq .TLSUsername "CommonName" }}selected{{end}}>Common Name</option>
        </select>
        <div id="idTLSUsernameHelp" class="form-text" data-i18n="filters.tls_username_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idFTPSecurity" data-i18n="filters.ftp_security" class="col-md-3 col-form-label">FTP security</label>
    <div class="col-md-9">
        <select id="idFTPSecurity" name="ftp_security" class="form-select" data-control="i18n-select2" data-hide-search="true" aria-describedby="idFTPSecurityHelp">
            <option value="" data-i18n="general.global_settings" {{if eq .FTPSecurity 0 }}selected{{end}}>Server settings</option>
            <option value="1" data-i18n="general.mandatory_encryption" {{if eq .FTPSecurity 1 }}selected{{end}}>Mandatory encryption</option>
        </select>
        <div id="idFTPSecurityHelp" class="form-text" data-i18n="filters.ftp_security_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idStartDirectory" data-i18n="filters.start_directory" class="col-md-3 col-form-label">Start directory</label>
    <div class="col-md-9">
        <input id="idStartDirectory" type="text" class="form-control" name="start_directory" value="{{.StartDirectory}}" aria-describedby="idStartDirectoryHelp" />
        <div id="idStartDirectoryHelp" class="form-text" data-i18n="filters.start_directory_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idHooks" data-i18n="filters.hooks" class="col-md-3 col-form-label">Hooks</label>
    <div class="col-md-9">
        <select id="idHooks" name="hooks" class="form-select" data-control="i18n-select2" data-hide-search="true" data-close-on-select="false" multiple>
            <option value="external_auth_disabled" data-i18n="filters.hook_ext_auth_disabled" {{if .Hooks.ExternalAuthDisabled}}selected{{end}}>
                External auth disabled
            </option>
            <option value="pre_login_disabled" data-i18n="filters.hook_pre_login_disabled" {{if .Hooks.PreLoginDisabled}}selected{{end}}>
                Pre-login disabled
            </option>
            <option value="check_password_disabled" data-i18n="filters.hook_check_password_disabled" {{if .Hooks.CheckPasswordDisabled}}selected{{end}}>
                Check password disabled
            </option>
        </select>
    </div>
</div>

<div class="form-group row align-items-center mt-10">
    <label data-i18n="filters.is_anonymous" class="col-md-3 col-form-label" for="idAnonymous">Is Anonymous</label>
    <div class="col-md-9">
        <div class="form-check form-switch form-check-custom form-check-solid">
            <input class="form-check-input" type="checkbox" id="idAnonymous" name="is_anonymous" {{if .IsAnonymous}}checked{{end}}/>
            <label data-i18n="filters.is_anonymous_help" class="form-check-label fw-semibold text-gray-800" for="idAnonymous">
                Anonymous users are supported for FTP and WebDAV protocols and have read-only access
            </label>
        </div>
    </div>
</div>

<div class="form-group row align-items-center mt-10">
    <label data-i18n="filters.disable_fs_checks" class="col-md-3 col-form-label" for="idDisableFsChecks">Disable filesystem checks</label>
    <div class="col-md-9">
        <div class="form-check form-switch form-check-custom form-check-solid">
            <input class="form-check-input" type="checkbox" id="idDisableFsChecks" name="disable_fs_checks" {{if .DisableFsChecks}}checked{{end}}/>
            <label data-i18n="filters.disable_fs_checks_help" class="form-check-label fw-semibold text-gray-800" for="idDisableFsChecks">
                Disable checks for existence and automatic creation of home directory and virtual folders
            </label>
        </div>
    </div>
</div>

<div class="form-group row align-items-center mt-10">
    <label data-i18n="general.api_key_auth" class="col-md-3 col-form-label" for="idAllowAPIKeyAuth">API key authentication</label>
    <div class="col-md-9">
        <div class="form-check form-switch form-check-custom form-check-solid">
            <input class="form-check-input" type="checkbox" id="idAllowAPIKeyAuth" name="allow_api_key_auth" {{if .AllowAPIKeyAuth}}checked{{end}}/>
            <label data-i18n="filters.api_key_auth_help" class="form-check-label fw-semibold text-gray-800" for="idAllowAPIKeyAuth">
                Allow to impersonate this user, in REST API, with an API key
            </label>
        </div>
    </div>
</div>
{{- end}}

{{- define "user_group_profile"}}
<div class="form-group row mt-10">
    <label for="idPasswordStrength" data-i18n="filters.password_strength" class="col-md-3 col-form-label">Password strength</label>
    <div class="col-md-9">
        <input id="idPasswordStrength" type="number" min="0" class="form-control" name="password_strength" value="{{.PasswordStrength}}" aria-describedby="idPasswordStrengthHelp"/>
        <div id="idPasswordStrengthHelp" class="form-text" data-i18n="filters.password_strength_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idPasswordExpiration" data-i18n="filters.password_expiration" class="col-md-3 col-form-label">Password expiration</label>
    <div class="col-md-9">
        <input id="idPasswordExpiration" type="number" min="0" class="form-control" name="password_expiration" value="{{.PasswordExpiration}}" aria-describedby="idPasswordExpirationHelp"/>
        <div id="idPasswordExpirationHelp" class="form-text" data-i18n="filters.password_expiration_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idDefaultSharesExpiration" data-i18n="filters.default_shares_expiration" class="col-md-3 col-form-label">Default shares expiration</label>
    <div class="col-md-9">
        <input id="idDefaultSharesExpiration" type="number" min="0" class="form-control" name="default_shares_expiration" value="{{.DefaultSharesExpiration}}" aria-describedby="idDefaultSharesExpirationHelp"/>
        <div id="idDefaultSharesExpirationHelp" class="form-text" data-i18n="filters.default_shares_expiration_help"></div>
    </div>
</div>

<div class="form-group row mt-10">
    <label for="idMaxSharesExpiration" data-i18n="filters.max_shares_expiration" class="col-md-3 col-form-label">Max shares expiration</label>
    <div class="col-md-9">
        <input id="idMaxSharesExpiration" type="number" min="0" class="form-control" name="max_shares_expiration" value="{{.MaxSharesExpiration}}" aria-describedby="idMaxSharesExpirationHelp"/>
        <div id="idMaxSharesExpirationHelp" class="form-text" data-i18n="filters.max_shares_expiration_help"></div>
    </div>
</div>
{{- end}}