feat: add fcp map

fix: fixed lazy fcp search
fix: try to fix preorder filter
This commit is contained in:
Luca Haid
2025-04-08 11:46:10 +02:00
parent 3d3e082fb5
commit 26b92c411c
7 changed files with 323 additions and 6 deletions
@@ -101,4 +101,28 @@ class ADBRimoFcpController extends TTCrud {
$counts['upd'], $counts['fcpNF'], $counts['noFCP'], $counts['noExtId']);
self::returnJson(['success' => true, 'message' => $msg]);
}
public function MapAction() {
Helper::renderVue($this, "ADBRimoFcpMap", "ADBRimoFcpMap", [
"MAPBOX_KEY" => TT_MAPBOX_TILE_API_TOKEN,
]);
}
public function getAllFCPsAction() {
$input = json_decode(file_get_contents('php://input'), true);
$fcpList = ADBRimoFcp::getAll();
$fcpData = array_map(function ($fcp) {
return [
'id' => $fcp->id,
// 'rimo_ex_state' => $fcp->rimo_ex_state,
// 'rimo_op_state' => $fcp->rimo_op_state,
'gps_lat' => $fcp->gps_lat,
'gps_long' => $fcp->gps_long
];
}, $fcpList);
self::returnJson(['success' => true, 'data' => $fcpData]);
}
}
+1 -1
View File
@@ -1095,7 +1095,7 @@ class PreorderController extends mfBaseController {
return array_map(
fn($fcp) => ["id" => $fcp->name ?? null, "text" => $fcp->name ?? null, 'lat' => $fcp->gps_lat ?? null, 'lng' => $fcp->gps_long ?? null],
ADBRimoFcp::getAll(["netzgebiet_id" => $campaign->network->adb_netzgebiet_id]) ?? []
ADBRimoFcp::getAll(["netzgebiet_id" => intval($campaign->network->adb_netzgebiet_id)]) ?? []
);
}
+16 -4
View File
@@ -1005,14 +1005,26 @@ class PreorderModel
}
}
}
if (!empty($filter['fcp'])) {
if (!empty($filter['fcp']) && array_key_exists("preordercampaign_id", $filter)) {
$fcp = $filter['fcp'];
$db = FronkDB::singleton();
$campaign = new Preordercampaign($filter['preordercampaign_id']);
if (is_array($fcp)) {
$items = array_map(fn($i) => "'" . $db->escape($i) . "'", array_filter($fcp));
if ($items) $where .= " AND adb_hausnummer.rimo_fcp_name IN (" . implode(',', $items) . ")";
$items = array_map(fn($i) => ADBRimoFcp::getAll([
'netzgebiet_id' => intval($campaign->network->adb_netzgebiet_id),
'name' => $i])[0], array_filter($fcp));
$items = array_map(fn($i) => $i->id, array_filter($items));
if ($items) $where .= " AND adb_hausnummer.fcp_id IN (" . implode(',', $items) . ")";
} else {
$fcp = ADBRimoFcp::getAll([
'netzgebiet_id' => intval($campaign->network->adb_netzgebiet_id),
'name' => $fcp]);
if ($fcp) $fcp = $fcp[0]->id;
else $fcp = null;
$where .= " AND adb_hausnummer.rimo_fcp_name = '" . $db->escape($fcp) . "'";
}
}