{{define "title"}}Edit Admin Access{{end}}
{{define "page_title"}}Edit Admin Access{{end}}

{{define "content"}}
<div class="row justify-content-center">
    <div class="col-lg-6">
        <div class="card">
            <div class="card-header"><h5 class="mb-0"><i class="bi bi-pencil-square me-2"></i>{{.target.Username}}'s domain access</h5></div>
            <div class="card-body">
                <form method="POST">
                    {{if .domains}}
                    <div class="border rounded p-3 mb-4" style="max-height: 300px; overflow-y: auto;">
                        {{range .domains}}
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" name="domain_ids" value="{{.ID}}" id="dom-{{.ID}}" {{if index $.assigned .ID}}checked{{end}}>
                            <label class="form-check-label" for="dom-{{.ID}}">{{.DomainName}}</label>
                        </div>
                        {{end}}
                    </div>
                    {{else}}
                    <p class="text-muted">You don't manage any domains to assign.</p>
                    {{end}}
                    <div class="d-flex justify-content-between">
                        <a href="/pymta-manager/admins" class="btn btn-secondary"><i class="bi bi-arrow-left me-2"></i>Back</a>
                        <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg me-2"></i>Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{{end}}
