Merge branch 'master' into 'fronkdev'

# Conflicts:
#   application/Preorder/PreorderController.php
This commit is contained in:
Frank Schubert
2025-09-17 10:17:18 +00:00
123 changed files with 9982 additions and 3945 deletions
+42 -1
View File
@@ -1095,6 +1095,8 @@ class PreorderController extends mfBaseController {
break;
case "denyCancelRequest":
$return = $this->denyCancelRequest();
case "getRimoFcpStats":
$return = $this->getRimoFcpStatsApi();
break;
default:
$return = false;
@@ -1270,11 +1272,28 @@ class PreorderController extends mfBaseController {
if (!$campaign->id) return [];
return array_map(
fn($fcp) => ["id" => $fcp->name ?? null, "text" => $fcp->name ?? null, 'lat' => $fcp->gps_lat ?? null, 'lng' => $fcp->gps_long ?? null],
fn($fcp) => ["real_id" => $fcp->id, "id" => $fcp->name ?? null, "text" => $fcp->name ?? null, 'lat' => $fcp->gps_lat ?? null, 'lng' => $fcp->gps_long ?? null],
ADBRimoFcp::getAll(["netzgebiet_id" => intval($campaign->network->adb_netzgebiet_id)]) ?? []
);
}
public function getRimoFcpStatsApi() {
$this->postData = json_decode(file_get_contents("php://input"));
$stats = ADBRimoFcp::getRimoFcpStatistics();
if (!empty($this->postData->fcp_ids)) {
$fcpIds = (array) $this->postData->fcp_ids;
$stats = array_filter($stats, fn($item) => in_array($item['fcp_id'], $fcpIds));
}
foreach ($stats as &$item)
if (isset($item['counts_by_rimo_type']) && is_string($item['counts_by_rimo_type']))
$item['counts_by_rimo_type'] = json_decode($item['counts_by_rimo_type']);
unset($item);
return array_values($stats);
}
private function setBilledApi() {
$preorder_id = $this->request->id;
@@ -1817,4 +1836,26 @@ class PreorderController extends mfBaseController {
$this->layout()->set("JSGlobals", $JSGlobals);
$this->layout()->setTemplate("VueViews/Vue"); // Assuming a generic Vue template
}
public function RimoTypeMapAction() {
$allowedCampaigns = Helper::getPreorderCampaignFromUser($this->me);
$campaignId = $this->request->preordercampaign_id ?? null;
if (!$campaignId || !in_array($campaignId, $allowedCampaigns)) {
$this->layout()->setFlash("Ungültige oder keine Kampagne ausgewählt.", "warning");
$this->redirect("Preorder", "Index");
}
Helper::renderVue($this, "PreorderRimoTypeMap", "PreorderRimoTypeMap", ["MAPBOX_KEY" => TT_MAPBOX_TILE_API_TOKEN]);
}
public function RimoTypeMapDataAction() {
$input = json_decode(file_get_contents('php://input'), true);
$campaignId = $input['campaignId'] ?? null;
$allowedCampaigns = Helper::getPreorderCampaignFromUser($this->me);
if (!$campaignId || !in_array($campaignId, $allowedCampaigns)) self::sendError('Ungültige oder keine Kampagne ausgewählt.');
$data = PreorderModel::getPreorderRimoTypeData($campaignId);
self::returnJson(['success' => true, 'data' => $data]);
}
}