71 lines
3.7 KiB
Cheetah
71 lines
3.7 KiB
Cheetah
{{define "edit_access"}}
|
|
<div class="page-container">
|
|
<div class="page-card" style="max-width: 640px; margin: 0 auto;">
|
|
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px;">
|
|
<div>
|
|
<h1>Edit access</h1>
|
|
<p class="intro">{{.GranteeName}}'s access to {{.TargetDossier.Name}}</p>
|
|
</div>
|
|
<a href="/dossier/{{.TargetDossier.DossierID}}" class="btn btn-secondary btn-small">{{.T.back}}</a>
|
|
</div>
|
|
|
|
{{if .Error}}<div class="error">{{.Error}}</div>{{end}}
|
|
{{if .Success}}<div class="success">{{.Success}}</div>{{end}}
|
|
|
|
<form action="/dossier/{{.TargetDossier.DossierID}}/access/{{.GranteeID}}" method="POST">
|
|
<input type="hidden" name="action" value="update">
|
|
|
|
<div style="margin-bottom: 32px;">
|
|
<h3>Permissions</h3>
|
|
<div style="display: flex; gap: 24px; flex-wrap: wrap;">
|
|
<label class="checkbox-label"><input type="checkbox" name="op_r" value="1" {{if .HasRead}}checked{{end}}><span>Read</span></label>
|
|
<label class="checkbox-label"><input type="checkbox" name="op_w" value="1" {{if .HasWrite}}checked{{end}}><span>Write</span></label>
|
|
<label class="checkbox-label"><input type="checkbox" name="op_d" value="1" {{if .HasDelete}}checked{{end}}><span>Delete</span></label>
|
|
<label class="checkbox-label"><input type="checkbox" name="op_m" value="1" {{if .HasManage}}checked{{end}}><span>Manage</span></label>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="margin-bottom: 32px; border-top: 1px solid var(--border); padding-top: 32px;">
|
|
<h3>Data access</h3>
|
|
<p style="color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px;">Select which types of data this person can access. Unchecked categories will be hidden.</p>
|
|
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;">
|
|
{{range .Categories}}
|
|
<label class="checkbox-label" style="padding: 12px; background: var(--bg-secondary); border-radius: 8px;">
|
|
<input type="checkbox" name="cat_{{.ID}}" value="1" {{if .Allowed}}checked{{end}}>
|
|
<span>{{.Name}}</span>
|
|
</label>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if .EntryGrants}}
|
|
<div style="margin-bottom: 32px; border-top: 1px solid var(--border); padding-top: 32px;">
|
|
<h3>Specific items shared</h3>
|
|
{{range .EntryGrants}}
|
|
<div style="display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border);">
|
|
<div>
|
|
<span style="font-weight: 500;">{{.Description}}</span>
|
|
<span style="color: var(--text-muted); font-size: 0.85rem; margin-left: 8px;">{{.CategoryName}}</span>
|
|
</div>
|
|
<button type="submit" name="remove_entry" value="{{.EntryID}}" class="btn btn-danger btn-small">Remove</button>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
<div style="display: flex; gap: 12px; margin-top: 24px;">
|
|
<a href="/dossier/{{.TargetDossier.DossierID}}" class="btn btn-secondary" style="flex: 1; text-align: center;">{{.T.cancel}}</a>
|
|
<button type="submit" class="btn btn-primary" style="flex: 1;">Save changes</button>
|
|
</div>
|
|
</form>
|
|
|
|
<div style="border-top: 1px solid var(--border); padding-top: 32px; margin-top: 32px;">
|
|
<form action="/dossier/{{.TargetDossier.DossierID}}/access/{{.GranteeID}}" method="POST" onsubmit="return confirm('Revoke all access for {{.GranteeName}}?');">
|
|
<input type="hidden" name="action" value="revoke">
|
|
<button type="submit" class="btn btn-danger btn-full">Revoke all access</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|