Commit 9d759f66 authored by Schindler, Laurenz's avatar Schindler, Laurenz
Browse files

Merge branch 'KeinKommentar' into 'master'

Kein kommentar

See merge request !33
parents cace4417 5b576e12
Pipeline #7695 passed with stage
in 4 minutes and 2 seconds
......@@ -6,6 +6,8 @@ class Appointment {
// leeres Appointment
Appointment.zero();
///Appointment aus einer Json Datei / Respons
factory Appointment.fromJson(Map<String, dynamic> appointment) => Appointment(
appointment['id'] as int,
appointment['name'] as String,
......@@ -17,7 +19,7 @@ class Appointment {
appointment['location'] as String,
appointment['note'] as String);
List<String> contactCodes = [];
List<String> contactCodes = []; //wäre für einladen und geteilte termine
int id;
String name;
int year;
......
......@@ -10,12 +10,12 @@ class Day {
List<Appointment> appointments;
@override
String toString() => weekday()+": $month/$day/$year";
String toString() => "${weekday()}: $month/$day/$year";
///überprüft ob der Tag richtig initalisiert ist
bool isValid()=> year != null && month != null && day != null;
///returnd den Wochentag als String
String weekday() {
switch (DateTime(year, month, day).weekday) {
case 1:
......
import 'package:demo/src/model/day.dart';
class Month {
// Constructor
Month(this.year,this.month);
Month(this.year, this.month);
int month;
int year;
///giebt eine woche zurück
///int week welche woche des monats ausgewählt werden soll
//weekOfMonth(1) wäre Montag der 27.06 bis Sonntag dem 02.07
Iterable weekOfMonth(int week) sync* {
final int firstWeekDayOfMonth = DateTime.utc(year, month, 1).weekday;
final int weekOffSet = -firstWeekDayOfMonth+2;
final int weekOffSet = -firstWeekDayOfMonth + 2;
int k = weekOffSet + 7 * week;
int count = 0;
// 6 * 7 Tage
while (count < 7) {
// adds a day on top now again from top
final DateTime time = DateTime.utc(year, month , k);
final DateTime time = DateTime.utc(year, month, k);
count++;
k++;
yield Day(time.year,time.month,time.day);
yield Day(time.year, time.month, time.day);
}
}
///gibt den monat als String zurück
@override
String toString(){
switch(month){
case 1: return "January";
case 2: return "February";
case 3: return "March";
case 4: return "April";
case 5: return "May";
case 6: return "June";
case 7: return "July";
case 8: return "August";
case 9: return "September";
case 10: return "October";
case 11: return "November";
case 12: return "December";
default: return month.toString();
String toString() {
switch (month) {
case 1:
return "January";
case 2:
return "February";
case 3:
return "March";
case 4:
return "April";
case 5:
return "May";
case 6:
return "June";
case 7:
return "July";
case 8:
return "August";
case 9:
return "September";
case 10:
return "October";
case 11:
return "November";
default:
return "December";
}
}
void previus(){
if(month -1 > 0) {
month = month - 1;
}else {
month = 12;
year = year - 1;
}
}
void next(){
if(month +1 < 13){
month = month +1;
}
else{
year = year +1;
month =1;
}
}
List<int> nextM(){
///wählt den nächsten monat aus
List<int> nextM() {
int yearOut = year;
int monthOut;
if(month + 1 <= 12) {
if (month + 1 <= 12) {
monthOut = month + 1;
}else {
} else {
monthOut = 1;
yearOut = year + 1;
}
return [yearOut,monthOut];
return [yearOut, monthOut];
}
List<int> prevM(){
///wählt den vorhergegangenen monat aus
List<int> prevM() {
int yearOut = year;
int monthOut;
if(month -1 > 0) {
if (month - 1 > 0) {
monthOut = month - 1;
}else {
} else {
month = 12;
yearOut = year - 1;
}
return [yearOut,monthOut];
return [yearOut, monthOut];
}
///liste die die wochentage für die CalenderView hält
final List<String> week = [
"Montag",
"Dienstag",
......
......@@ -60,6 +60,7 @@ class User extends Person {
};
// gets all of the ENDBENUTZER Contacts
// ignore: missing_return
Map<String, Contact> getMyContacts() {}
}
......
......@@ -4,7 +4,6 @@ import 'package:angular_router/angular_router.dart';
import 'package:demo/src/model/person.dart';
import 'package:demo/src/view/routes/route_paths.dart';
import 'package:demo/src/view/services/person_service.dart';
import 'package:demo/src/view/components/login_component.dart';
......@@ -17,7 +16,7 @@ import '../main_component.dart';
styleUrls: ['account_component.css'],
directives: [coreDirectives, routerDirectives, formDirectives],
)
/// Klasse zur verwaltung der Termine
/// Klasse zur verwaltung des Accounts
class AccountComponent implements OnActivate {
AccountComponent(this._userService, this._location, this._router);
......
import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';
import 'package:angular_router/angular_router.dart';
import 'package:demo/src/model/appointment.dart';
import 'package:demo/src/view/routes/route_paths.dart';
import 'package:demo/src/view/services/appointment_service.dart';
import 'package:demo/src/view/components/login_component.dart';
......@@ -65,5 +62,4 @@ class AppointmentComponent implements OnActivate {
///Methode, die die übergeordnete ansicht anzeigt
void goBack() => _location.back();
}
......@@ -17,6 +17,7 @@ import 'package:demo/src/view/services/appointment_service.dart';
providers: [ClassProvider(AppointmentService)],
pipes: [commonPipes],
)
///Klasse zum suchen eines Termins
class AppointmentSearchComponent implements OnInit {
AppointmentSearchComponent(this._appointmentService, this._router);
......@@ -28,7 +29,7 @@ class AppointmentSearchComponent implements OnInit {
final StreamController<String> _searchTerms = StreamController<String>.broadcast();
///suche im Service
void search(String term) => _searchTerms.add(term);
@override
......@@ -41,10 +42,11 @@ class AppointmentSearchComponent implements OnInit {
: _appointmentService.search(term).asStream()))
.handleError(print);
}
///erstellt eine Richtige URL zum Termin
String _appointmentUrl(int id) =>
RoutePaths.appointment.toUrl(parameters: {idParam: '$id'});
///öffnet ein Termin mit gegebener ID
Future<NavigationResult> gotoDetail(Appointment appointment) =>
_router.navigate(_appointmentUrl(appointment.id));
}
......@@ -26,10 +26,11 @@ class CalendarComponent implements OnActivate, OnInit {
int today;
int thisMonth;
// auswählen des Tages
/// auswählen des Tages
Future<NavigationResult> gotoDetail(Day day) =>
_router.navigate(dayUrl(day.year, day.month, day.day));
///überprüft ob der Tag Termine hat
int daysAppointments(Day day) {
return appointments
.where((app) =>
......@@ -39,7 +40,7 @@ class CalendarComponent implements OnActivate, OnInit {
.toList()
.length;
}
// todo bug in anderen monaten
Future<void> _getAppointments() async {
today = DateTime.now().day;
thisMonth = DateTime.now().month;
......@@ -65,6 +66,7 @@ class CalendarComponent implements OnActivate, OnInit {
}
}
///erstellt immer die passende Url
String monthURL(String year, String month) =>
RoutePaths.calendar.toUrl(parameters: {yParam: year, mParam: month});
......@@ -75,12 +77,14 @@ class CalendarComponent implements OnActivate, OnInit {
dParam: "$dayInt"
});
///navigiert zum näcshten Monat
// ignore: unused_element
void next() {
_router.navigate(monthURL(
month.nextM().first.toString(), month.nextM().last.toString()));
}
///navigiert zum vorherigen Monat
// ignore: unused_element
void previous() {
_router.navigate(monthURL(
......
......@@ -17,12 +17,12 @@ import 'package:demo/src/view/services/contact_service.dart';
styleUrls: ['contact_component.css'],
directives: [coreDirectives, routerDirectives, formDirectives],
)
/// Klasse zur verwaltung der Termine
/// Klasse zur verwaltung der Kontakte
class ContactComponent implements OnActivate {
ContactComponent(this._contactService, this._location, this._router);
Contact contact = Contact(1,'lauri','Schindler','Laurenz','lauri.s@web.de','295145','Er ist einer');
Contact contact;
final Location _location;
final Router _router;
String note;
......@@ -50,7 +50,7 @@ class ContactComponent implements OnActivate {
goBack();
}
///Methode zum löschen von Terminen
///Methode zum löschen von einem Kontakt
Future<void> delete() async {
if (deleteControl==true) {
await _contactService.delete(contact.contactCode);
......
......@@ -19,7 +19,7 @@ import 'contact_search_component.dart';
directives: [coreDirectives, routerDirectives, formDirectives, ContactComponent, ContactSearchComponent],
)
///Klasse zum anzeigen aller contacte
///Klasse zum anzeigen aller Kontakte
class ContactListComponent implements OnInit, OnActivate {
ContactListComponent(this._contactService, this._router);
......@@ -36,12 +36,6 @@ class ContactListComponent implements OnInit, OnActivate {
contacts = await _contactService.getAll();
}
/*Future<void> add(String name) async {
name = name.trim();
if (name.isEmpty) return null;
appointments.add(await _appointmentService.create(name));
selected = null;
}*/
///Nachfolgender Code wird bei der inizialisierung der Klasse ausgeführt
@override
......@@ -76,6 +70,7 @@ class ContactListComponent implements OnInit, OnActivate {
}
}
///Funktion die immer beim erstellen aufgerufen wird
@override
Future onActivate(RouterState previous, RouterState current) async {
if (!LoginComponent.loggedIn) {
......@@ -83,6 +78,7 @@ class ContactListComponent implements OnInit, OnActivate {
}
}
///funktion zum löschen eines Kontakts
Future<void> delete(Contact contact) async {
if (deleteControl==true) {
await _contactService.delete(contact.contactCode);
......
......@@ -28,7 +28,7 @@ class ContactSearchComponent implements OnInit {
final StreamController<String> _searchTerms = StreamController<String>.broadcast();
///sucht mit einem String nach einem Kontakt
void search(String term) => _searchTerms.add(term);
@override
......@@ -41,7 +41,7 @@ class ContactSearchComponent implements OnInit {
: _contactService.search(term).asStream()))
.handleError(print);
}
///erstellt immer die passende Url
String _contactUrl(String number) =>
RoutePaths.contact.toUrl(parameters: {idParam: '$number'});
......
......@@ -33,7 +33,7 @@ class DashboardComponent implements OnInit, OnActivate {
joke = await _dashboardService.getJoke();
}
}
///lädt einen nueuen witz
void refresh() async{
joke = await _dashboardService.getJoke();
}
......
......@@ -2,7 +2,6 @@ import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';
import 'package:angular_router/angular_router.dart';
import 'package:demo/src/view/components/login_component.dart';
import 'package:demo/src/view/services/person_service.dart';
import 'package:demo/src/view/services/register_service.dart';
import '../../model/person.dart';
......
......@@ -8,6 +8,7 @@ const String dParam ="day";
class RoutePaths {
///Definition der routpaths dazu werden noch mögliche url parameter festgelegt
static final RoutePath dashboard = RoutePath(path: 'dashboard');
static final RoutePath appointments = RoutePath(path: 'appointments');
static final RoutePath appointmentNew = RoutePath(path: 'appointmentNew');
......@@ -18,12 +19,11 @@ class RoutePaths {
static final RoutePath register = RoutePath(path: 'register');
static final RoutePath login = RoutePath(path: 'login');
static final RoutePath account = RoutePath(path: 'account');
static final RoutePath contacts = RoutePath(path: 'contacts');
static final RoutePath contact = RoutePath(path: '${contacts.path}/:$conParam');
}
///Funktionen die aus der Url Parameter lesen
int getYear(Map<String, String> parameters) {
final id = parameters[yParam];
return id == null ? null : int.tryParse(id);
......
......@@ -20,7 +20,7 @@ import 'route_paths.dart';
export 'route_paths.dart';
class Routes {
// hier wird eine precompiled component eingebunden als sample+
/// Die routpaths werden den einzelnen komponenten zugewiesen
static final RouteDefinition calendar = RouteDefinition(
routePath: RoutePaths.calendar,
component: calendar_template.CalendarComponentNgFactory as ComponentFactory,
......
import 'dart:async';
import 'dart:convert';
import 'package:aqueduct/aqueduct.dart';
import 'package:middleman/model/person.dart';
......
import 'package:middleman/middleman.dart';
class Appointment extends ManagedObject<_Appointment> implements _Appointment {}
///Model der des Appointments in der Datenbank
class _Appointment {
@primaryKey
int id;
......
......@@ -10,7 +10,7 @@ class User extends ManagedObject<_User> implements _User,ManagedAuthResourceOwne
class Contact extends ManagedObject<_Contact> implements _Contact {}
///Model der des Contacts in der Datenbank
class _Contact{
@Column(unique: false,nullable: true)
String note;
......@@ -31,7 +31,7 @@ class _Contact{
String email;
}
///Model der des Users in der Datenbank
class _User extends ResourceOwnerTableDefinition {
@Column(unique: false, nullable: true)
......
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