Files
amsterdam/ui/views/memberlist.jet
T

157 lines
8.0 KiB
Plaintext

{*
* Amsterdam Web Communities System
* Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*}
<div class="p-4">
<!-- Page Title with Tabs -->
<div class="mb-6">
<div class="flex items-baseline gap-2">
<h1 class="text-blue-800 text-4xl font-bold">Members of Community:</h1>
<span class="text-blue-800 text-2xl">{{ comm.Name }}</span>
</div>
<hr class="border-2 border-gray-400 w-4/5 mt-2 mb-6">
</div>
{{ if canExport }}
<div class="flex">
[
<a href="/comm/{{ comm.Alias }}/members/export" class="text-blue-700 hover:text-blue-900">Export Member List</a>
]
</div>
{{ end }}
{{ if isset(errorMessage) }}
<!-- Error Message Banner -->
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6" id="error-banner">
<div class="flex items-center">
<div class="flex-shrink-0">
<span class="text-red-500 text-xl">⚠️</span>
</div>
<div class="ml-3">
<p class="text-sm font-medium" id="error-message">{{ CapitalizeString(errorMessage) }}.</p>
</div>
</div>
</div>
{{ end }}
<!-- Search Form -->
<div class="max-w-3xl mb-8">
<form method="POST" action="/comm/{{ comm.Alias }}/members">
<input type="hidden" name="ofs" value="0">
<div class="bg-gray-50 p-6 rounded-lg">
<h2 class="text-xl font-bold text-black mb-4">Find Members of Community "{{ comm.Name }}":</h2>
<div class="space-y-4">
<!-- Field Selection -->
<div class="flex items-center gap-2 text-sm">
<span class="text-black">Display all community members whose</span>
<select name="field"
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option value="name" {{ if field == "name" }}selected{{ end }}>user name</option>
<option value="descr"{{ if field == "descr" }}selected{{ end }}>description</option>
<option value="first"{{ if field == "first" }}selected{{ end }}>first name</option>
<option value="last"{{ if field == "last" }}selected{{ end }}>last name</option>
</select>
</div>
<!-- Search Criteria -->
<div class="flex items-center gap-2 text-sm flex-wrap">
<select name="oper"
class="px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option value="st" {{ if oper == "st" }}selected{{ end }}>starts with the string</option>
<option value="in" {{ if oper == "in" }}selected{{ end }}>contains the string</option>
<option value="re" {{ if oper == "in" }}selected{{ end }}>matches the regular expression</option>
</select>
<input type="text" name="term" size="32" maxlength="255" value="{{ term }}"
placeholder="Enter search term..."
class="flex-1 min-w-64 px-3 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
<!-- Search Button -->
<div>
<button type="submit" name="search"
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
Search
</button>
</div>
</div>
</div>
</form>
</div>
<!-- Member List -->
<hr class="border-gray-400 mb-4">
<div class="flex justify-between items-center mb-4">
<div class="text-sm text-black font-bold">{{ headerLine }}</div>
</div>
{{ if isset(resultList) }}
<!-- Results List -->
<div class="bg-gray-50 p-6 rounded-lg">
<div class="space-y-4">
{{ range _, rx := resultList }}
<!-- User Result -->
<div class="flex items-start gap-3">
<span class="text-sm pt-0.5 flex-shrink-0">🟣</span>
<div class="flex-1">
<div class="mb-2">
<a href="/user/{{ rx.Username }}"
class="text-blue-700 hover:text-blue-900 font-bold text-base">{{ rx.Username }}</a>
{{ if rx.Uid == hostUid }}
<span class="ml-1">👑</span>
{{ end }}
</div>
<div class="text-sm text-gray-700 space-y-1">
<div>
{{ ci := UserContactInfo(rx, .) }}
{{ DisplayFullName(ci) }}, from {{ ci.Locality }}, {{ ci.Region }} {{ ci.Country }}
</div>
</div>
</div>
</div>
{{ end }}
</div>
{{ if isset(resultShowPrev) || isset(resultShowNext) }}
<div class="flex justify-center gap-4 mt-6">
{{ if isset(fromSearch) }}
<form method="POST" action="/comm/{{ comm.Alias }}/members">
<input type="hidden" name="ofs" value="{{ ofs }}"/>
<input type="hidden" name="field" value="{{ field }}"/>
<input type="hidden" name="oper" value="{{ oper }}"/>
<input type="hidden" name="term" value="{{ term }}"/>
{{ if isset(resultShowPrev) }}
<button type="submit" name="prev"
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
⏪ Prev
</button>
{{ end }}
{{ if isset(resultShowNext) }}
<button type="submit" name="next"
class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-2 rounded font-medium transition-colors">
Next ⏩
</button>
{{ end }}
</form>
{{ else }}
{{ if isset(resultShowPrev) }}
<a href="/comm/{{ comm.Alias }}/members?ofs={{ ofs - 1 }}"
class="inline-block bg-blue-600 hover:bg-blue-700 text-white px-4 py-1 rounded text-xs font-medium transition-colors">
⏪ Prev
</a>
{{ end }}
{{ if isset(resultShowNext) }}
<a href="/comm/{{ comm.Alias }}/members?ofs={{ ofs + 1 }}"
class="inline-block bg-blue-600 hover:bg-blue-700 text-white px-4 py-1 rounded text-xs font-medium transition-colors">
Next ⏩
</a>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
{{ end }}
</div>