Files
wp-multi-teamcard/includes/team-members-tab.php

93 lines
5.1 KiB
PHP

<?php
// Diese Datei wird in der Haupt-Admin-Datei included.
?>
<div class="teamcard-tab-content">
<p><strong>Hinweis:</strong> Beim Löschen des Plugins werden alle Teammitglieder und zugehörigen Daten unwiderruflich aus der Datenbank entfernt. Bitte erstellen Sie ein Backup, falls Sie die Daten behalten möchten.</p>
<div class="teamcard-add-new-form">
<h2>Neues Teammitglied hinzufügen</h2>
<div class="form-fields">
<div class="form-field">
<label for="new-teamcard-name">Name:</label>
<input type="text" id="new-teamcard-name" placeholder="Name eingeben" required>
</div>
<div class="form-field">
<label for="new-teamcard-funktion">Funktion:</label>
<input type="text" id="new-teamcard-funktion" placeholder="Funktion eingeben">
</div>
<div class="form-field">
<label for="new-teamcard-zustaendigkeit">Zuständigkeit / Über mich:</label>
<textarea id="new-teamcard-zustaendigkeit" placeholder="Zuständigkeit oder Text für die Rückseite der Flip-Card eingeben"></textarea>
</div>
<div class="form-field">
<label for="new-teamcard-card-type">Card-Typ:</label>
<select id="new-teamcard-card-type">
<option value="standard">Standard Card</option>
<option value="compact">Compact Card</option>
<option value="featured">Featured Card</option>
<!-- NEUE OPTIONEN -->
<option value="flip">Flip Card</option>
<option value="profile">Profile Card</option>
</select>
</div>
<div class="form-field">
<label>Bild:</label>
<div class="image-preview-container">
<img id="new-teamcard-bild-vorschau" src="" style="display:none; max-width:100px;">
</div>
<input type="hidden" id="new-teamcard-bild-id" value="">
<button type="button" class="button" id="new-teamcard-bild-button">Bild auswählen</button>
</div>
<div class="form-field">
<button type="button" id="add-teamcard-button" class="button button-primary">Teammitglied hinzufügen</button>
</div>
</div>
</div>
<h2>Vorhandene Teammitglieder</h2>
<p>Ziehe die Zeilen, um die Reihenfolge zu ändern. Klicke auf die Felder, um sie zu bearbeiten.</p>
<table class="wp-list-table widefat fixed striped teamcard-table">
<thead>
<tr>
<th class="column-thumbnail">Bild</th>
<th>Name</th>
<th>Funktion</th>
<th>Zuständigkeit</th>
<th>Typ</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody id="teamcard-list">
<?php
$teamcards = get_posts(['post_type' => 'teamcard', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC']);
foreach ($teamcards as $teamcard) {
$funktion = get_post_meta($teamcard->ID, '_teamcard_funktion', true);
$zustaendigkeit = get_post_meta($teamcard->ID, '_teamcard_zustaendigkeit', true);
$bild_id = get_post_meta($teamcard->ID, '_teamcard_bild_id', true);
$card_type = get_post_meta($teamcard->ID, '_teamcard_card_type', true);
$bild_url = $bild_id ? wp_get_attachment_image_url($bild_id, 'thumbnail') : '';
?>
<tr data-id="<?php echo $teamcard->ID; ?>" class="teamcard-item">
<td class="teamcard-bild-column">
<div class="image-preview-container">
<?php if ($bild_url): ?>
<img src="<?php echo esc_url($bild_url); ?>" class="teamcard-bild-vorschau">
<?php endif; ?>
</div>
<button type="button" class="button teamcard-bild-button" data-id="<?php echo $teamcard->ID; ?>">Ändern</button>
</td>
<td><div class="editable" data-field="title" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($teamcard->post_title); ?></div></td>
<td><div class="editable" data-field="funktion" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($funktion); ?></div></td>
<td><div class="editable" data-field="zustaendigkeit" data-id="<?php echo $teamcard->ID; ?>"><?php echo esc_html($zustaendigkeit); ?></div></td>
<td><?php echo esc_html(ucfirst($card_type ?: 'standard')); ?></td>
<td><button type="button" class="button button-small teamcard-delete" data-id="<?php echo $teamcard->ID; ?>">Löschen</button></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div id="teamcard-message" class="notice" style="display:none;"></div>
</div>