Commit b160948e authored by Thomas Frion's avatar Thomas Frion
Browse files

[UPDC|FEAT] Update msg data to diplay & load existing geoloc

parent 9ef509a9
......@@ -22,14 +22,16 @@
<tr>
<th></th>
<th>Type</th>
<th>Langue</th>
<th>Date</th>
<th>Réseau</th>
<th>Statut</th>
</tr>
<tr *ngFor='let msg of messages' >
<ng-container *ngIf="msg | msguseragent; let ua">
<td title="{{ua}}">{{msg | messagenum}}</td>
<td title="{{ua}}">{{msg.message.type}}</td>
<td title="{{ua}}">{{msg.message.language | messagelang}}</td>
<td title="{{ua}}">{{msg.sent_at | date: "HH:mm"}}</td>
<td title="{{ua}}">{{msg.network}}</td>
<td [innerHTML]="msg | messagestatus" (click)='centerGeoloc(msg)'></td>
</ng-container>
</tr>
......
......@@ -9,8 +9,7 @@ import { PhoneWSService } from '
import { GeoJSONCollection, GeoJSON } from '../pghm-api/choucas/geojson';
import { PhoneCountry, MessageSent, PhonePosition, PhoneWS } from '../pghm-api/choucas/models/phone';
import { MessageTypeResource, PhoneCountryResource, MessageSentResource } from '../pghm-api/choucas/choucas';
import { environment } from 'src/environments/environment';
import { Unit, UnitModel, UnitSetting } from '../pghm-api/choucas/models/unit';
@Component({
selector: 'app-sms-component',
......@@ -80,6 +79,7 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
wsservice.init(msg.hash);
this.wss.push(wsservice);
wsservice.message.subscribe(this.dispatchws.bind(this));
this.displayExistingGeoloc(msg);
})
},
err => {console.error(err)}
......@@ -132,7 +132,6 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
}
}
const unit = new UnitModel((JSON.parse(localStorage.getItem(environment.localStorage.unit)) as GeoJSON<Unit>).properties);
const map = this.mapSrv.map as L.Map;
map.flyTo(
L.latLng(
......@@ -177,4 +176,15 @@ export class SmsComponentComponent implements OnInit, OnDestroy {
this.updateMsgList(data.data as MessageSent)
}
}
private displayExistingGeoloc(msg: MessageSent) : void {
const geojson = msg.geolocs;
L.geoJSON(<any> geojson, {
pointToLayer: (feat, latLng) => {
let radius = feat.properties.accuracy;
radius = radius <= 15 ? 15 : radius;
return L.circle(latLng, radius, {color: "#ff0000", weight:5})
}
}).addTo(this.positions);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment