2017-07-15 23:42:50 +08:00
|
|
|
<form #settingsForm="ngForm" class="form-horizontal">
|
2018-05-14 04:59:57 +08:00
|
|
|
<div class="card mb-4">
|
|
|
|
<h5 class="card-header">
|
2019-08-20 18:54:45 +08:00
|
|
|
<ng-container i18n>Map settings</ng-container><ng-container *ngIf="changed">*</ng-container>
|
2018-05-14 04:59:57 +08:00
|
|
|
<div class="switch-wrapper">
|
2017-07-14 05:39:09 +08:00
|
|
|
<bSwitch
|
2017-07-15 18:47:11 +08:00
|
|
|
class="switch"
|
2017-07-14 05:39:09 +08:00
|
|
|
name="enabled"
|
|
|
|
[switch-on-color]="'success'"
|
2019-07-21 01:52:47 +08:00
|
|
|
[switch-inverse]="true"
|
2018-03-30 08:30:23 +08:00
|
|
|
[switch-off-text]="text.Disabled"
|
|
|
|
[switch-on-text]="text.Enabled"
|
2017-07-15 18:47:11 +08:00
|
|
|
[switch-disabled]="inProgress"
|
2019-07-21 01:52:47 +08:00
|
|
|
[switch-handle-width]="100"
|
|
|
|
[switch-label-width]="20"
|
2017-07-15 23:29:40 +08:00
|
|
|
[(ngModel)]="settings.enabled">
|
2017-07-14 05:39:09 +08:00
|
|
|
</bSwitch>
|
2017-07-15 18:47:11 +08:00
|
|
|
</div>
|
2018-05-14 04:59:57 +08:00
|
|
|
</h5>
|
|
|
|
<div class="card-body">
|
2017-07-15 18:47:11 +08:00
|
|
|
<div [hidden]="!error" class="alert alert-danger" role="alert"><strong>Error: </strong>{{error}}</div>
|
2019-07-21 17:23:08 +08:00
|
|
|
<ng-container *ngIf="settings.enabled">
|
2017-07-15 18:47:11 +08:00
|
|
|
|
2019-07-21 17:23:08 +08:00
|
|
|
<div class="form-group row" [hidden]="simplifiedMode">
|
|
|
|
<label class="col-md-2 control-label" for="enableOnScrollRendering" i18n>Use image markers</label>
|
|
|
|
<div class="col-md-10">
|
|
|
|
<bSwitch
|
|
|
|
id="enableOnScrollRendering"
|
|
|
|
class="switch"
|
|
|
|
name="enableOnScrollRendering"
|
|
|
|
[switch-on-color]="'primary'"
|
|
|
|
[switch-inverse]="true"
|
|
|
|
[switch-off-text]="text.Disabled"
|
|
|
|
[switch-on-text]="text.Enabled"
|
|
|
|
[switch-handle-width]="100"
|
|
|
|
[switch-label-width]="20"
|
|
|
|
[(ngModel)]="settings.useImageMarkers">
|
|
|
|
</bSwitch>
|
2019-07-21 21:14:12 +08:00
|
|
|
<small class="form-text text-muted" i18n>
|
|
|
|
Map will use thumbnail images as markers instead of the default pin.
|
2019-07-21 17:23:08 +08:00
|
|
|
</small>
|
|
|
|
</div>
|
2018-12-08 05:06:13 +08:00
|
|
|
</div>
|
|
|
|
|
2019-07-21 01:52:47 +08:00
|
|
|
|
2019-07-21 17:23:08 +08:00
|
|
|
<div class="form-group row">
|
|
|
|
<label class="col-md-2 control-label" for="mapProvider" i18n>Map provider</label>
|
|
|
|
<div class="col-md-10">
|
|
|
|
<select name="mapProvider" id="mapProvider"
|
|
|
|
[disabled]="!settings.enabled"
|
|
|
|
class="form-control" [(ngModel)]="settings.mapProvider" required>
|
|
|
|
<option *ngFor="let type of mapProviders" [ngValue]="type.key">{{type.value}}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2019-07-21 01:52:47 +08:00
|
|
|
</div>
|
2017-07-14 05:39:09 +08:00
|
|
|
|
2019-07-21 17:23:08 +08:00
|
|
|
<div class="container custom-layer-container" *ngIf="settings.mapProvider === MapProviders.Custom">
|
|
|
|
<table class="table table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th i18n>Name</th>
|
|
|
|
<th i18n>Tile Url*</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tr *ngFor="let layer of settings.customLayers; let i = index">
|
|
|
|
<td><input type="text" class="form-control" placeholder="Street"
|
|
|
|
[(ngModel)]="layer.name"
|
|
|
|
[name]="'tileName-'+i" [id]="'tileName-'+i" required></td>
|
|
|
|
<td>
|
|
|
|
<input type="text" class="form-control" placeholder="http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
|
|
[(ngModel)]="layer.url"
|
|
|
|
[name]="'tileUrl-'+i" [id]="'tileUrl-'+i" required>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<button [disabled]="settings.customLayers.length == 1" (click)="removeLayer(layer)"
|
|
|
|
[ngClass]="settings.customLayers.length > 1? 'btn-danger':'btn-secondary'"
|
|
|
|
class="btn float-right">
|
|
|
|
<span class="oi oi-trash" aria-hidden="true" aria-label="Delete"></span>
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div class="row justify-content-end">
|
|
|
|
<small class="form-text text-muted custom-layer-info">
|
|
|
|
<ng-container i18n>*The map module will use these urls to fetch the map tiles.</ng-container>
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
<div class="row justify-content-end">
|
|
|
|
<button class="btn btn-primary"
|
|
|
|
(click)="addNewLayer()" i18n>+ Add Layer
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-12-08 18:28:56 +08:00
|
|
|
</div>
|
|
|
|
|
2019-07-21 17:23:08 +08:00
|
|
|
<div class="form-group row" *ngIf="settings.mapProvider === MapProviders.Mapbox">
|
|
|
|
<label class="col-md-2 control-label" for="mapboxAccessToken" i18n>Mapbox access token</label>
|
|
|
|
<div class="col-md-10">
|
|
|
|
<input type="text" class="form-control" placeholder="Mapbox access token"
|
|
|
|
[(ngModel)]="settings.mapboxAccessToken"
|
|
|
|
name="mapboxAccessToken" id="mapboxAccessToken" required>
|
|
|
|
<small class="form-text text-muted">
|
|
|
|
<ng-container i18n>MapBox needs an access token to work, create one at</ng-container>
|
|
|
|
<a href="https://www.mapbox.com">https://www.mapbox.com</a>.
|
|
|
|
</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-12-08 18:28:56 +08:00
|
|
|
|
2019-07-21 17:23:08 +08:00
|
|
|
</ng-container>
|
2018-05-14 04:59:57 +08:00
|
|
|
<button class="btn btn-success float-right"
|
2017-07-15 18:47:11 +08:00
|
|
|
[disabled]="!settingsForm.form.valid || !changed || inProgress"
|
2017-12-25 07:42:25 +08:00
|
|
|
(click)="save()" i18n>Save
|
2017-07-15 18:47:11 +08:00
|
|
|
</button>
|
2019-02-23 07:29:35 +08:00
|
|
|
<button class="btn btn-secondary float-right"
|
2019-12-08 01:16:37 +08:00
|
|
|
[disabled]=" !changed || inProgress"
|
2017-12-25 07:42:25 +08:00
|
|
|
(click)="reset()" i18n>Reset
|
2017-07-15 18:47:11 +08:00
|
|
|
</button>
|
|
|
|
</div>
|
2017-07-14 05:39:09 +08:00
|
|
|
</div>
|
2017-07-15 18:47:11 +08:00
|
|
|
|
|
|
|
</form>
|