Merge branch 'RimoFCP/integrate' into 'master'

added fcps to preorder map

See merge request fronk/thetool!1161
This commit is contained in:
Luca Haid
2025-04-02 07:38:03 +00:00
2 changed files with 17 additions and 1 deletions

View File

@@ -854,6 +854,8 @@ $pagination_entity_name = "Vorbestellungen";
});
//fetch fcps and show on map
getFCPs(preorderMap);
// calculate center position
mapCenterPos = GetCenterFromDegrees(all_coords);
@@ -862,6 +864,20 @@ $pagination_entity_name = "Vorbestellungen";
return true;
}
async function getFCPs(map) {
var fcp = await $.get("<?=self::getUrl("Preorder", "Api")?>", {
do: "getFCPsForCampaign",
campaign_id: "<?=$campaign->id?>"
});
if(fcp.status == "OK") {
fcp.result.forEach((fcp) => {
var icon = L.MakiMarkers.icon({icon: "viewpoint", color: "yellow", size: "m"});
var marker = L.marker([fcp.lat, fcp.lng], {icon: icon}).addTo(map);
});
}
}
function centerMap() {
preorderMap.setView(mapCenterPos, 12);
}

View File

@@ -1094,7 +1094,7 @@ class PreorderController extends mfBaseController {
if (!$campaign->id) return [];
return array_map(
fn($fcp) => ["id" => $fcp->name ?? null, "text" => $fcp->name ?? null],
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]) ?? []
);
}