cheesegrits / filament-google-maps

Google Maps package for Filament PHP
247 stars 69 forks source link

MapEntry and Map together #88

Open up2marius opened 9 months ago

up2marius commented 9 months ago

Hello,

I have an issue having the MapEntry in the infolist and a custom action that opens a modal with Map::make().. the map doesn't render the drawingControls.

If I remove the MapEntry from the infolist, everything it's ok.

Map::make('area') ->label(__("Draw a delivery area on this map. Only one delivery zone will be saved:")) ->mapControls([ 'mapTypeControl' => false, 'scaleControl' => true, 'streetViewControl' => false, 'rotateControl' => false, 'fullscreenControl' => true, 'searchBoxControl' => false, // creates geocomplete field inside map 'zoomControl' => true, ]) ->defaultZoom(14) ->live() ->drawingModes([ 'polygon' => true, ]) ->polyOptions([ 'strokeColor' => '#000000', 'fillColor' => '#000000', ]) ->drawingControl() ->drawingField('drawing_field') ->debug() ->height(fn () => '600px') ->draggable(false) ->clickable(true) ->geoJson(function () use ($infolist){ $area = json_decode($infolist->record->area->toFeatureCollectionJson()); $area->features[0]->properties = ['type' => 'polygon']; return json_encode($area); }) ->defaultLocation(function () use ($infolist){ return $infolist->record->location; })