Commit b99c494e authored by Yannick Lehnhausen's avatar Yannick Lehnhausen

add info modal for POIs to show when users are not logged in

parent 787c183c
......@@ -39,6 +39,7 @@ import {AddEditBottomViewComponent} from './components/add-edit/common/add-edit-
import {AddEditPersonComponent} from './components/add-edit/add-edit-person/add-edit-person.component';
import {AddEditContentComponent} from './components/add-edit/add-edit-content/add-edit-content.component';
import {AddEditUserComponent} from './components/add-edit/add-edit-user/add-edit-user.component';
import {InfoPoiComponent} from './components/info/info-poi/info-poi.component';
import {RestoreComponent} from './components/pages/restore/restore.component';
import {ConfirmComponent} from './components/common/confirm/confirm.component';
import {ActiveModalMockService} from './services/active-modal-mock/active-modal-mock.service';
......@@ -86,6 +87,7 @@ export function testModule(): NgModule {
AddEditPersonComponent,
AddEditContentComponent,
AddEditUserComponent,
InfoPoiComponent,
RestoreComponent,
ConfirmComponent,
LoginComponent,
......@@ -158,6 +160,7 @@ export function testModule(): NgModule {
AddEditPersonComponent,
AddEditContentComponent,
AddEditUserComponent,
InfoPoiComponent,
RestoreComponent,
ConfirmComponent,
MultiModelInputComponent,
......@@ -200,6 +203,7 @@ export function testModule(): NgModule {
AddEditContentComponent,
AddEditPersonComponent,
AddEditUserComponent,
InfoPoiComponent,
],
})
export class AppModule {
......
<div class="modal-body">
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Name</label>
<div class="col-9">
<input class="form-control form-control-sm" appFocus type="text" [(ngModel)]="poi.name" disabled>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Persons</label>
<div class="col-9" disabled>
<app-multi-model-input [modelList]="poi.persons"
[modelDefinition]="personModelDefinition" disabled></app-multi-model-input>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Contents</label>
<div class="col-9">
<app-multi-model-input [modelList]="poi.contents"
[modelDefinition]="contentModelDefinition" disabled></app-multi-model-input>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Levels</label>
<div class="col-9">
<div class="btn-group btn-group-sm btn-group-toggle" data-toggle="buttons">
<label *ngFor="let level of possibleLevels"
class="btn btn-outline-primary"
ngbButtonLabel>
<input type="checkbox" autocomplete="off" ngbButton [ngModel]="poi.levels.includes(level)"
(click)="toggleLevel(level)" disabled>
{{level}}
</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Description</label>
<div class="col-9">
<textarea class="form-control form-control-sm" rows="4" [(ngModel)]="poi.description" disabled></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Building</label>
<div class="col-9">
<input class="form-control form-control-sm" type="text" [(ngModel)]="poi.building" disabled>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Street</label>
<div class="col-9">
<input class="form-control form-control-sm" type="text" [(ngModel)]="poi.street" disabled>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">ZIP</label>
<div class="col-9">
<input class="form-control form-control-sm" type="text" [(ngModel)]="poi.zip" disabled>
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">City</label>
<div class="col-9">
<input class="form-control form-control-sm" type="text" [(ngModel)]="poi.city" disabled >
</div>
</div>
<div class="form-group row">
<label class="col-3 col-form-label col-form-label-sm">Contacts</label>
<div class="col-9">
<app-contact-input [contacts]="poi.contacts" disabled></app-contact-input>
</div>
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AddEditPoiComponent } from './add-edit-poi.component';
import {testModule} from '../../../app.module';
describe('AddEditPoiComponent', () => {
let component: AddEditPoiComponent;
let fixture: ComponentFixture<AddEditPoiComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule(testModule()).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AddEditPoiComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit, AfterViewInit, Input} from '@angular/core';
import {poiModelDefinition} from '../../../model-definitions/PoiModelDefinition';
import {CommonAddEditService} from '../../../services/common-add-edit/common-add-edit.service';
import {PoiModel} from '../../../models/poi.model';
import {CategoryModel} from '../../../models/category.model';
import {categoryModelDefinition} from '../../../model-definitions/CategoryModelDefinition';
import {personModelDefinition} from '../../../model-definitions/PersonModelDefinition';
import {contentModelDefinition} from '../../../model-definitions/ContentModelDefinition';
import {BuildingModel} from '../../../models/building.model';
import {Level} from '../../../models/sub-types/level.model';
@Component({
selector: 'app-add-edit-poi',
templateUrl: './info-poi.component.html',
styleUrls: ['./info-poi.component.css'],
providers: [CommonAddEditService],
})
export class InfoPoiComponent implements OnInit {
@Input() id: string;
@Input() long: number;
@Input() lat: number;
@Input() level: number;
@Input() building: BuildingModel;
public readonly modelDefinition = poiModelDefinition;
categoryModelDefinition = categoryModelDefinition;
possibleLevels: number[] = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
personModelDefinition = personModelDefinition;
contentModelDefinition = contentModelDefinition;
constructor(public commonAddEditService: CommonAddEditService) {
}
async ngOnInit(): Promise<void> {
await this.commonAddEditService.init(this.modelDefinition, this.id);
if (this.lat != null && this.long != null) {
this.poi.longitude = this.long;
this.poi.latitude = this.lat;
}
if (this.building && this.level) {
this.poi.building = this.building.toString();
this.poi.city = this.building.address.city;
this.poi.street = `${this.building.address.street} ${this.building.address.housenumber}`;
this.poi.zip = this.building.address.postcode.toString();
this.poi.levels.push(this.level);
}
}
get poi(): PoiModel {
return this.commonAddEditService.object as PoiModel;
}
setCategory(category: CategoryModel) {
this.poi.category = category;
}
toggleLevel(level: number) {
if (this.poi.levels.includes(level)) {
this.poi.levels = this.poi.levels.filter((value) => value !== level);
} else {
this.poi.levels.push(level);
}
this.poi.levels.sort();
}
}
......@@ -34,6 +34,7 @@ import {Edge} from '../../models/sub-types/edge.model';
import {EdgeNode} from '../../models/sub-types/edgenode.model';
import {NavigationEndType} from '../../enums/NavigationEndType';
import {forEach} from '@angular/router/src/utils/collection';
import {InfoPoiComponent} from '../../components/info/info-poi/info-poi.component';
@Injectable()
export class MapRendererService {
......
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