Update profile modal: username text + publish checkbox + editable fields

This commit is contained in:
Kato
2026-09-02 20:14:25 +00:00
parent 89c8a36d8b
commit 890e6c0ad2
3 changed files with 72 additions and 25 deletions
+2
View File
@@ -83,6 +83,8 @@ a:hover { text-decoration: underline; }
.modal-content { background: var(--white); padding: 32px; border-radius: 16px; width: 90%; max-width: 500px; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,.2); } .modal-content { background: var(--white); padding: 32px; border-radius: 16px; width: 90%; max-width: 500px; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.modal-content h3 { margin-bottom: 24px; } .modal-content h3 { margin-bottom: 24px; }
.close-btn { position: absolute; top: 16px; right: 20px; font-size: 24px; cursor: pointer; color: #6b7280; } .close-btn { position: absolute; top: 16px; right: 20px; font-size: 24px; cursor: pointer; color: #6b7280; }
.username-display { padding: 12px 0; font-size: 1.1rem; font-weight: 600; color: var(--black); }
.profile-form .hidden { display: none; }
.login-panel h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--gray2); } .login-panel h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--gray2); }
.form-group { margin-bottom: 16px; } .form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; } .form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
+48 -12
View File
@@ -175,25 +175,61 @@
<span class="close-btn" onclick="closeProfileModal()">&times;</span> <span class="close-btn" onclick="closeProfileModal()">&times;</span>
<h3 class="hide-de">Profil bearbeiten</h3> <h3 class="hide-de">Profil bearbeiten</h3>
<h3 class="hide-en">Edit Profile</h3> <h3 class="hide-en">Edit Profile</h3>
<form id="profile-form"> <div class="profile-form">
<div class="form-group"> <div class="form-group">
<label for="profile-username" class="hide-de">Telegram Nutzername</label> <label class="hide-de">Telegram Nutzername</label>
<label for="profile-username" class="hide-en">Telegram Username</label> <label class="hide-en">Telegram Username</label>
<input type="text" id="profile-username" disabled /> <div class="username-display" id="profile-username-display">odoo4projects</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="profile-name" class="hide-de">Vollständiger Name</label> <label class="hide-de">Veröffentlichen</label>
<label for="profile-name" class="hide-en">Full name</label> <label class="hide-en">Publish</label>
<input type="text" id="profile-name" required /> <div style="display: flex; align-items: center; gap: 8px;">
<input type="checkbox" id="profile-publish" />
<span class="hide-de">Folgendes veröffentlichen:</span>
<span class="hide-en">Publish the following:</span>
</div>
</div> </div>
<div class="form-group"> <div id="profile-edit-fields" class="hidden">
<label for="profile-llc" class="hide-de">Name der LLC / SRL</label> <div class="form-group">
<label for="profile-llc" class="hide-en">LLC / SRL name</label> <label for="profile-name" class="hide-de">Vollständiger Name</label>
<input type="text" id="profile-llc" required /> <label for="profile-name" class="hide-en">Full name</label>
<input type="text" id="profile-name" />
</div>
<div class="form-group">
<label for="profile-company" class="hide-de">Name der LLC / SRL</label>
<label for="profile-company" class="hide-en">LLC / SRL name</label>
<input type="text" id="profile-company" />
</div>
<div class="form-group">
<label for="profile-email" class="hide-de">E-Mail</label>
<label for="profile-email" class="hide-en">Email</label>
<input type="email" id="profile-email" />
</div>
<div class="form-group">
<label for="profile-homepage" class="hide-de">Homepage</label>
<label for="profile-homepage" class="hide-en">Homepage</label>
<input type="url" id="profile-homepage" />
</div>
<div class="form-group">
<label for="profile-image" class="hide-de">Bild URL</label>
<label for="profile-image" class="hide-en">Image URL</label>
<input type="text" id="profile-image" />
</div>
<div class="form-group">
<label for="profile-location" class="hide-de">Standort</label>
<label for="profile-location" class="hide-en">Location</label>
<input type="text" id="profile-location" />
</div>
<div class="form-group">
<label for="profile-description" class="hide-de">Beschreibung</label>
<label for="profile-description" class="hide-en">Description</label>
<textarea id="profile-description" rows="4"></textarea>
</div>
</div> </div>
<button type="button" class="btn-primary hide-de" onclick="saveProfile()">Speichern</button> <button type="button" class="btn-primary hide-de" onclick="saveProfile()">Speichern</button>
<button type="button" class="btn-primary hide-en" onclick="saveProfile()">Save</button> <button type="button" class="btn-primary hide-en" onclick="saveProfile()">Save</button>
</form> </div>
</div> </div>
</div> </div>
+22 -13
View File
@@ -267,14 +267,18 @@ async function openProfileModal() {
const response = await fetch(PROFILE_URL + '?sessionid=' + encodeURIComponent(sessionid)); const response = await fetch(PROFILE_URL + '?sessionid=' + encodeURIComponent(sessionid));
console.log('openProfileModal response:', response.status, await response.clone().json()); console.log('openProfileModal response:', response.status, await response.clone().json());
if (response.ok) { if (response.ok) {
const data = await response.json(); const user = await response.json();
console.log('openProfileModal data:', data); console.log('openProfileModal user:', user);
if (data.data && Array.isArray(data.data) && data.data.length > 0) { document.getElementById('profile-username-display').textContent = user.username || '';
const user = data.data[0]; document.getElementById('profile-name').value = user.name || '';
document.getElementById('profile-username').value = user.username || ''; document.getElementById('profile-company').value = user.company || '';
document.getElementById('profile-name').value = user.name || ''; document.getElementById('profile-email').value = user.email || '';
document.getElementById('profile-llc').value = user.company || ''; document.getElementById('profile-homepage').value = user.homepage || '';
} document.getElementById('profile-image').value = user.image || '';
document.getElementById('profile-location').value = user.location || '';
document.getElementById('profile-description').value = user.Description || '';
document.getElementById('profile-publish').checked = true;
document.getElementById('profile-edit-fields').classList.remove('hidden');
} }
} catch (error) { } catch (error) {
console.error('openProfileModal error:', error); console.error('openProfileModal error:', error);
@@ -295,17 +299,22 @@ function logout() {
async function saveProfile() { async function saveProfile() {
const name = document.getElementById('profile-name').value.trim(); const name = document.getElementById('profile-name').value.trim();
const llc = document.getElementById('profile-llc').value.trim(); const company = document.getElementById('profile-company').value.trim();
if (!name || !llc) { alert('Bitte geben Sie Name und LLC-Namen ein.'); return; } if (!name || !company) { alert('Bitte geben Sie Name und LLC-Namen ein.'); return; }
try { try {
const response = await fetch(API_URL, { const response = await fetch(PROFILE_URL, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
username: document.getElementById('profile-username').value, username: document.getElementById('profile-username-display').textContent,
name: name, name: name,
llc: llc company: company,
email: document.getElementById('profile-email').value,
homepage: document.getElementById('profile-homepage').value,
image: document.getElementById('profile-image').value,
location: document.getElementById('profile-location').value,
Description: document.getElementById('profile-description').value
}) })
}); });
console.log('saveProfile response:', response.status, await response.clone().json()); console.log('saveProfile response:', response.status, await response.clone().json());