88use Admin \Traits \FormModelWidget ;
99use Admin \Traits \ValidatesForm ;
1010use Igniter \Flame \Exception \ApplicationException ;
11- use Igniter \Flame \Html \HtmlFacade as Html ;
1211use Illuminate \Database \Eloquent \Collection ;
1312use Illuminate \Support \Facades \DB ;
1413
@@ -102,7 +101,7 @@ public function loadAssets()
102101 if (strlen ($ key = setting ('maps_api_key ' ))) {
103102 $ url = 'https://maps.googleapis.com/maps/api/js?key=%s&libraries=geometry ' ;
104103 $ this ->addJs (sprintf ($ url , $ key ),
105- ['name ' => 'google-maps-js ' , 'async ' => null , 'defer ' => null ]
104+ ['name ' => 'google-maps-js ' , 'async ' => null , 'defer ' => null ],
106105 );
107106 }
108107
@@ -175,14 +174,14 @@ public function onSaveRecord()
175174
176175 $ modelsToSave = $ this ->prepareModelsToSave ($ model , $ saveData );
177176
178- DB ::transaction (function () use ($ modelsToSave ) {
177+ DB ::transaction (function () use ($ modelsToSave ) {
179178 foreach ($ modelsToSave as $ modelToSave ) {
180179 $ modelToSave ->saveOrFail ();
181180 }
182181 });
183182
184183 flash ()->success (sprintf (lang ('admin::lang.alert_success ' ),
185- 'Area ' .($ form ->context == 'create ' ? 'created ' : 'updated ' )
184+ 'Area ' .($ form ->context == 'create ' ? 'created ' : 'updated ' ),
186185 ))->now ();
187186
188187 $ this ->formField ->value = null ;
@@ -216,11 +215,11 @@ public function onDeleteArea()
216215 ];
217216 }
218217
219- public function getMapShapeAttributes ($ area )
218+ public function getMapAreaShapes ($ area )
220219 {
221220 $ areaColor = $ area ->color ;
222221
223- $ attributes = [
222+ $ attributes = collect ()-> push ( [
224223 'data-id ' => $ area ->area_id ?? 1 ,
225224 'data-name ' => $ area ->name ?? '' ,
226225 'data-default ' => $ area ->type ?? 'address ' ,
@@ -234,9 +233,11 @@ public function getMapShapeAttributes($area)
234233 'strokeColor ' => $ areaColor ,
235234 'distanceUnit ' => setting ('distance_unit ' ),
236235 ]),
237- ];
236+ ]);
237+
238+ $ this ->fireSystemEvent ('maparea.extendMapAreaShapes ' , [$ area , $ attributes ]);
238239
239- return Html:: attributes ( $ attributes) ;
240+ return $ attributes ;
240241 }
241242
242243 protected function getMapAreas ()
0 commit comments