|
@@ -62,13 +62,6 @@ export class MapComponent implements OnInit {
|
|
|
|
|
|
mapClicked($event: MouseEvent) {
|
|
mapClicked($event: MouseEvent) {
|
|
|
|
|
|
- const dataMap={
|
|
|
|
- latitude: $event.coords.lat,
|
|
|
|
- longitude: $event.coords.lng,
|
|
|
|
- id: 1
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- console.log('responce map', dataMap);
|
|
|
|
this.markers[0].lat = $event.coords.lat;
|
|
this.markers[0].lat = $event.coords.lat;
|
|
this.markers[0].lng = $event.coords.lng;
|
|
this.markers[0].lng = $event.coords.lng;
|
|
// this.markers.push({
|
|
// this.markers.push({
|
|
@@ -77,28 +70,47 @@ export class MapComponent implements OnInit {
|
|
// draggable: true
|
|
// draggable: true
|
|
// });
|
|
// });
|
|
|
|
|
|
- this.http.post(this.authSer.pathApi + '/edit_reach_map', dataMap).subscribe(
|
|
|
|
- (responce) => {
|
|
|
|
- console.log(responce);
|
|
|
|
- this.toastr.success('تم حفظ الموقع');
|
|
|
|
- },
|
|
|
|
- (error) => {
|
|
|
|
- console.log(error);
|
|
|
|
- this.toastr.error('خطأ في الموقع إنتظر قليلاً');
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- console.log(this.markers);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
markerDragEnd(m: marker, $event: MouseEvent) {
|
|
markerDragEnd(m: marker, $event: MouseEvent) {
|
|
console.log('dragEnd', m, $event);
|
|
console.log('dragEnd', m, $event);
|
|
|
|
+ this.markers[0].lat = $event.coords.lat;
|
|
|
|
+ this.markers[0].lng = $event.coords.lng;
|
|
|
|
+ console.log('wwwwwwwwwwwwwwwwwwwwww' , this.markers);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+saveLocation() {
|
|
|
|
+ console.log(this.markers);
|
|
|
|
|
|
|
|
+ const dataMap={
|
|
|
|
+ latitude: this.markers[0].lat,
|
|
|
|
+ longitude: this.markers[0].lng,
|
|
|
|
+ id: 1
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log('responce map', dataMap);
|
|
|
|
+
|
|
|
|
+ this.http.post(this.authSer.pathApi + '/edit_reach_map', dataMap).subscribe(
|
|
|
|
+ (responce) => {
|
|
|
|
+ console.log(responce);
|
|
|
|
+ this.toastr.success('تم حفظ الموقع');
|
|
|
|
+ },
|
|
|
|
+ (error) => {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.toastr.error('خطأ في الموقع إنتظر قليلاً');
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
// just an interface for type safety.
|
|
// just an interface for type safety.
|
|
interface marker {
|
|
interface marker {
|