admin: add AJAX fallback for wahl phase count; use ajax in force-zuteilung JS
All checks were successful
Deploy Workshop-Wahlen (DEV / PROD) / deploy (push) Successful in 11s

This commit is contained in:
Blitz08
2026-01-31 11:45:36 +01:00
parent eb7afe06ff
commit 67222fc6f9
2 changed files with 27 additions and 1 deletions

View File

@@ -1,4 +1,16 @@
<?php
// AJAX endpoint to return wahl details (anzahl_einheiten)
add_action('wp_ajax_kc_get_wahl', function(){
global $wpdb;
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if (!$id) {
wp_send_json_error('missing id');
}
$row = $wpdb->get_row($wpdb->prepare("SELECT id, COALESCE(anzahl_einheiten,1) as anzahl_einheiten FROM {$wpdb->prefix}kc_wahlen WHERE id=%d", $id));
if (!$row) wp_send_json_error('not found');
wp_send_json_success(['id'=>intval($row->id),'anzahl_einheiten'=>intval($row->anzahl_einheiten)]);
});
/**
* Plugin Name: Workshop-Wahlen
* Description: Workshop-Wahl-System für Konfi-Castle.com