Commit e56acd32 authored by Mauritz, Falk Marius's avatar Mauritz, Falk Marius
Browse files

Merge remote-tracking branch 'origin/AqueductBranch' into Authentifizierung

# Conflicts:
#	frontend/lib/src/view/components/register_component.dart
#	frontend/lib/src/view/services/contact_service.dart
#	frontend/test/test.dart
#	middleman/lib/controller/user_controller.dart
parents 76bcab2a d6c11c16
......@@ -15,10 +15,19 @@
resize: none;
}
#stern{
margin:6px;
font-size: 12px;
}
#delete {
color: red;
}
.invalid-feedback {
margin:6px;
}
label {
width: 100%;
}
......@@ -31,19 +31,35 @@
<div class="form-group">
<label for="time">Uhrzeit</label>
<input type="text" class="form-control" id="time" placeholder="00:00"
<input type="text" class="form-control" id="time"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#time="ngForm"
[class.is-valid]="time.valid"
[class.is-invalid]="!time.valid"
[(ngModel)]="appointment.time" ngControl="time">
<div [hidden]="time.valid || time.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
<label for="duration">Dauer</label>
<input type="text" class="form-control" id="duration" placeholder="00:00"
<input type="text" class="form-control" id="duration"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#duration="ngForm"
[class.is-valid]="duration.valid"
[class.is-invalid]="!duration.valid"
[(ngModel)]="appointment.duration" ngControl="duration">
<div [hidden]="duration.valid || duration.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
<label for="location">Ort</label>
<input type="text" class="form-control" id="location" required placeholder="Ort"
<input type="text" class="form-control" id="location" placeholder="Ort"
[(ngModel)]="appointment.location" ngControl="location">
</div>
......
.selected {
background-color: #CFD8DC !important;
color: white;
}
.appointments {
margin: 0 0 2em 0;
list-style-type: none;
......@@ -23,7 +19,7 @@
background-color: #DDD;
left: .1em;
}
.appointments li.selected:hover {
.appointments li.today:hover {
background-color: #BBD8DC !important;
color: white;
}
......
<h3>Agenda</h3>
<h3>All Appointments (Agenda)</h3>
<appointment-search id="search"></appointment-search>
<ul class="appointments">
......
......@@ -21,7 +21,6 @@ class AppointmentNewComponent implements OnActivate {
AppointmentNewComponent(this._appointmentService, this._location, this._router);
//Später löschen
Appointment appointment = Appointment.zero();
final Location _location;
final AppointmentService _appointmentService;
......
......@@ -31,14 +31,30 @@
<div class="form-group">
<label for="time">Uhrzeit</label>
<input type="text" class="form-control" id="time" placeholder="00:00"
<input type="text" class="form-control" id="time"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#time="ngForm"
[class.is-valid]="time.valid"
[class.is-invalid]="!time.valid"
[(ngModel)]="appointment.time" ngControl="time">
<div [hidden]="time.valid || time.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
<label for="duration">Dauer</label>
<input type="text" class="form-control" id="duration" placeholder="00:00"
<input type="text" class="form-control" id="duration"
pattern="(0[0-9]|1[0-9]|2[0-4])(:[0-5][0-9])"
placeholder="HH:MM"
#duration="ngForm"
[class.is-valid]="duration.valid"
[class.is-invalid]="!duration.valid"
[(ngModel)]="appointment.duration" ngControl="duration">
<div [hidden]="duration.valid || duration.pristine" class="invalid-feedback">
Please follow the pattern HH:MM
</div>
</div>
<div class="form-group">
......@@ -49,13 +65,13 @@
<div class="form-group">
<label for="note">Note: </label>
<textarea type="text" class="form-control" id="note" placeholder="note"
<textarea type="text" class="form-control" id="note" placeholder="note"
[(ngModel)]="appointment.note" name="note" rows="4"></textarea>
<div id="stern">
fields with a <b>*</b> are required
</div>
</div>
<div>
* fields are required
</div>
<button type="submit" [disabled]="!newAppointmentForm.form.valid" class="btn btn-success" (click)="create()">
Create
......
<div id="search-component">
<input #searchBox id="search-box"
placeholder="Search"
(change)="search(searchBox.value)"
(keyup)="search(searchBox.value)" />
<div>
......
.today {
background-color: lightgreen;
}
td{
border-width:2px;
border-style: solid;
......@@ -54,6 +58,11 @@ th{
text-align: center;
}
div .appointmentNotifier{
color: red;
}
/*
colors to use if possible (descending) :
#FF7B89
......
......@@ -23,6 +23,8 @@ class CalendarComponent implements OnActivate, OnInit {
List<String> get week => month.week;
List<Appointment> appointments = [];
int today;
int thisMonth;
// auswählen des Tages
Future<NavigationResult> gotoDetail(Day day) =>
......@@ -39,6 +41,8 @@ class CalendarComponent implements OnActivate, OnInit {
}
// todo bug in anderen monaten
Future<void> _getAppointments() async {
today = DateTime.now().day;
thisMonth = DateTime.now().month;
appointments = await _appointmentService.getByDate(month.year, month.month);
appointments.sort((a, b) => a.id.compareTo(b.id));
}
......
......@@ -6,32 +6,32 @@
<th *ngFor="let day of week">{{day}}</th>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(0)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(0)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(1)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(1)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(2)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(2)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(3)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(3)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(4)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(4)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
<tr>
<td *ngFor="let day of month.weekOfMonth(5)" (click)="gotoDetail(day)">{{day.day}}
<td *ngFor="let day of month.weekOfMonth(5)" [class.today]="day.day === today && day.month === thisMonth" (click)="gotoDetail(day)">{{day.day}}
<div *ngIf="daysAppointments(day) != 0" class="appointmentNotifier">{{daysAppointments(day)}}</div>
</td>
</tr>
......
......@@ -32,18 +32,16 @@ class ContactComponent implements OnActivate {
/// Folgender Code wird immer bei der Aktivierung der Klasse aufgerufen
@override
void onActivate(_, RouterState current) async {
/*if (!LoginComponent.loggedIn) {
if (!LoginComponent.loggedIn) {
await _router.navigate('/login');
} else {
*/
final con = getNumber(current.parameters);
if (getNumber != null) {
// ignore: unnecessary_parenthesis
contact = await (_contactService.get(con));
note = contact.note;
}
//}
}
}
/// Methode zum speichern, der änderungen die man im Kontakt vorgenommen hat
......
......@@ -21,7 +21,7 @@
[(ngModel)]="contact.note" name="note" rows="4"></textarea>
</div>
<button (click)="save()" class="btn back" type="submit">Save</button>
<button (click)="save()" class=" btn-success" type="submit">Save</button>
<button type="button" class="btn back" (click)="goBack()">GoBack</button>
......
.selected {
background-color: #CFD8DC !important;
color:#00302f;
}
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css');
button {
background-color: #eee;
......@@ -21,18 +17,43 @@ h3{
text-align: center;
}
li{
border-bottom: solid;
cursor: pointer;
margin-top: 2%;
margin-left: 2%;
}
ol{
ul{
list-style-type: none;
overflow-y:scroll;
height: 70%;
border: 1px #484848 solid;
background: #758EB7;
margin-left: 2%;
margin-right: 2%;
}
div>button{
float: left;
}
ol{
margin-left: 2%;
margin-right: 2%;
}
\ No newline at end of file
.form-control {
margin:5px;
width: 97%;
float: left;
}
table{
overflow-y:scroll;
}
table tr{
cursor: pointer;
}
#header{
cursor: default;
}
#delete {
color: red;
}
......@@ -9,11 +9,14 @@ import 'package:demo/src/view/components/login_component.dart';
import 'package:demo/src/view/routes/route_paths.dart';
import 'package:demo/src/view/services/contact_service.dart';
import 'contact_component.dart';
import 'contact_search_component.dart';
@Component(
selector: 'contacts',
templateUrl: 'contact_list_component.html',
styleUrls: ['contact_list_component.css'],
directives: [coreDirectives, routerDirectives, formDirectives],
directives: [coreDirectives, routerDirectives, formDirectives, ContactComponent, ContactSearchComponent],
)
///Klasse zum anzeigen aller contacte
......@@ -23,11 +26,10 @@ class ContactListComponent implements OnInit, OnActivate {
final ContactService _contactService;
final Router _router;
List<Contact> contacts;
Contact selected;
String contactCode ="";
///Methode zum auswählen eines contacts
void onSelect(Contact contact) => selected = contact;
bool valid = true;
bool exists = false;
bool deleteControl = false;
///Methode die eine Liste aller appointments zurückgibt
Future<void> _getContacts() async {
......@@ -53,11 +55,25 @@ class ContactListComponent implements OnInit, OnActivate {
///Methode die den ausgewählten contact aufruft
Future<NavigationResult> gotoDetail() =>_router.navigate(_contactUrl(selected.contactCode));
Future<NavigationResult> gotoDetail(Contact contact) =>_router.navigate(_contactUrl(contact.contactCode));
Future<void> addContact() async {
await _contactService.create(await _contactService.find(contactCode));
await _router.navigate(_contactUrl(contactCode));
if (contacts.any((h) => h.contactCode == contactCode)) {
exists = true;
valid = true;
} else {
final Contact contact = await _contactService.find(contactCode);
if (contact == null) {
valid = false;
exists = false;
} else {
print(contacts);
await _contactService.create(contact);
await _getContacts();
valid = true;
exists = false;
}
}
}
@override
......@@ -67,4 +83,14 @@ class ContactListComponent implements OnInit, OnActivate {
}
}
Future<void> delete(Contact contact) async {
if (deleteControl==true) {
await _contactService.delete(contact.contactCode);
await _getContacts();
deleteControl = false;
} else {
deleteControl = true;
}
}
}
<h3>Contacts</h3>
<ol class="contacts">
<li *ngFor="let contact of contacts"
[class.selected]="contact === selected"
(click)="onSelect(contact)">
<span>{{contact.name}} </span>
<span>{{contact.email}} </span>
</li>
</ol>
<div *ngIf="selected != null">
<button (click)="gotoDetail()">View Details</button>
<contact-search id="search"></contact-search>
<table class="table">
<tr id="header">
<td><b>Nickname: </b></td>
<td><b>Surname: </b></td>
<td><b>Name: </b></td>
<td><b>E-Mail: </b></td>
<td><b>Delete</b></td>
</tr>
<tr *ngFor="let contact of contacts" id="contact">
<tr (click)="gotoDetail(contact)">{{contact.nickname}}</tr>
<td (click)="gotoDetail(contact)">{{contact.surname}}</td>
<td (click)="gotoDetail(contact)">{{contact.name}}</td>
<td (click)="gotoDetail(contact)">{{contact.email}}</td>
<td (click)="delete(contact)">X</td>
</tr>
<tr></tr>
</table>
<div [hidden]="!deleteControl" id="delete">
If you really want to delete this Contact click "Delete" again.
</div>
<form action="/action_page.php">
<div class="form-group">
<input type="text" class="form-control" id="contactCode" placeholder="ContactCode"
[(ngModel)]="contactCode" name="contactCode">
<button (click)="addContact()" type="submit">Add Contact</button>
<div id="con">
<div [hidden]="valid">
The given ContactCode does not exist
</div>
<div [hidden]="!exists">
The Contact with this ContactCode does already exists
</div>
</div>
</div>
</form>
.search-result {
border-bottom: 1px solid gray;
border-left: 1px solid gray;
border-right: 1px solid gray;
width:195px;
height: 20px;
padding: 5px;
background-color: white;
cursor: pointer;
}
#search-box {
width: 200px;
height: 20px;
}
\ No newline at end of file
import 'dart:async';
import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';
import 'package:stream_transform/stream_transform.dart';
import 'package:demo/src/model/person.dart';
import 'package:demo/src/view/routes/route_paths.dart';
import 'package:demo/src/view/services/contact_service.dart';
@Component(
selector: 'contact-search',
templateUrl: 'contact_search_component.html',
styleUrls: ['contact_search_component.css'],
directives: [coreDirectives],
providers: [ClassProvider(ContactService)],
pipes: [commonPipes],
)
class ContactSearchComponent implements OnInit {
ContactSearchComponent(this._contactService, this._router);
ContactService _contactService;
Router _router;
Stream<List<Contact>> contacts;
final StreamController<String> _searchTerms = StreamController<String>.broadcast();
void search(String term) => _searchTerms.add(term);
@override
void ngOnInit() async {
contacts = _searchTerms.stream
.transform(debounce(Duration(milliseconds: 300)))
.distinct()
.transform(switchMap((term) => term.isEmpty
? Stream<List<Contact>>.fromIterable([<Contact>[]])
: _contactService.search(term).asStream()))
.handleError(print);
}
String _contactUrl(String number) =>
RoutePaths.contact.toUrl(parameters: {idParam: '$number'});
Future<NavigationResult> gotoDetail(Contact contact) =>
_router.navigate(_contactUrl(contact.contactCode));
}
<div id="search-component">
<input #searchBox id="search-box"
placeholder="Search"
(change)="search(searchBox.value)"
(keyup)="search(searchBox.value)" />
<div>
<div *ngFor="let contact of contacts | async"
(click)="contact.delete()" class="search-result" >
{{contact.nickname}}
</div>
</div>
</div>
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css');
\ No newline at end of file
......@@ -33,4 +33,8 @@ class DashboardComponent implements OnInit, OnActivate {
joke = await _dashboardService.getJoke();
}
}
void refresh() async{
joke = await _dashboardService.getJoke();
}
}
\ No newline at end of file
Supports Markdown
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