Commit e10aeaf7 by Riina Antikainen

merge

2 parents be947dad ba42812e
......@@ -18,7 +18,7 @@
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.4",
"@angular/platform-browser": "^5.2.0",
......
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
<div>
<moya-organization-list style="float:top, left;"></moya-organization-list>
<h1 style="text-align:center; margin-left:25%; display:inline-block">
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
<a style="float:right; font-size:20px; margin-top: 20px" href="#">Moya Login</a>
</div>
<div style="width:50%; float:left">
<h2 style="margin-left: 10px">Tulevat tapahtumat</h2>
<moya-event-list [organisation]="currentOrganisation" style="margin-top:5em;"></moya-event-list>
</div>
<div style="width:50%; float:right">
<h2>Ei omaa organisaatiota?</h2>
<button (click)="newOrg()">Luo uusi organisaatio</button>
</div>
<<<<<<< HEAD
<moya-organization-list></moya-organization-list>
<moya-event-list></moya-event-list>
\ No newline at end of file
<moya-event-list></moya-event-list>
=======
>>>>>>> ba42812ec6cdee25062402ba6d95b939c43ed534
......@@ -8,7 +8,7 @@ import { AppService } from './shared/app.service';
})
export class AppComponent {
title = 'Moay';
public currentOrganisation = 'insomnia';
constructor(private appService: AppService) {
console.log(this.appService.get());
}
......
<mat-card *ngFor="let event of events" style="width:40%;margin:1em;">
<mat-card *ngFor="let event of events" style="margin:1em;max-width:75%">
<mat-card-title>{{event.title}}</mat-card-title>
<mat-card-subtitle>{{event.date}}</mat-card-subtitle>
<mat-card-actions>
<button mat-raised-button color="primary" (click)="onClick()" style="float:right;margin-top:-5em;margin-right:1em;">Edit</button>
</mat-card-actions>
<!--<mat-card-actions>
<button mat-raised-button color="primary" (click)="onClick()" style="float:right;margin-top: ;margin-right:1em;">Edit</button>
</mat-card-actions>-->
</mat-card>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import { EventsService } from './event-service.service';
@Component({
selector: 'moya-event-list',
......@@ -6,15 +7,12 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./event-list.component.scss']
})
export class EventListComponent implements OnInit {
@Input() organisation: string;
public events: any;
public events = [
{title: 'Assembly Winter 18', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Summer 18', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Winter 19', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Summer 19', date: '1.2.2018 - 3.2.2018'}
];
constructor() { }
constructor(private appService: EventsService) {
this.events = (this.appService.get(this.organisation));
}
onClick() {
console.log('Nappitoimii');
......
import { TestBed, inject } from '@angular/core/testing';
import { EventsService } from './event-service.service';
describe('EventsService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [EventsService]
});
});
it('should be created', inject([EventsService], (service: EventsService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
@Injectable()
export class EventsService {
get(org: String) {
if (org.localeCompare('asm') === 0) {
return [
{title: 'Assembly Winter 18', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Summer 18', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Winter 19', date: '1.2.2018 - 3.2.2018'},
{title: 'Assembly Summer 19', date: '1.2.2018 - 3.2.2018'}
];
}
return [
{title: 'No future events to show at the moment', date: ' '}
];
}
}
<p>
new-organization works!
</p>
<form [formGroup]="organizationForm" (ngSubmit)="onSubmit()">
<mat-form-field>
<input matInput required placeholder="Organization name" formControlName="name">
</mat-form-field>
<mat-divider [vertical]="true"></mat-divider>
<mat-form-field>
<input matInput placeholder="Address" formControlName="address">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Postal code" formControlName="postcode">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="City" formControlName="city">
</mat-form-field>
<mat-divider [vertical]="true"></mat-divider>
<mat-form-field>
<input matInput placeholder="Business ID" formControlName="businessId">
</mat-form-field>
<mat-divider [vertical]="true"></mat-divider>
<mat-form-field>
<input matInput placeholder="Bank name" formControlName="bankName">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="IBAN" formControlName="iban">
</mat-form-field>
<mat-divider [vertical]="true"></mat-divider>
<button mat-button type="submit">Submit</button>
</form>
import { Component, OnInit } from '@angular/core';
import {FormControl, FormGroup} from '@angular/forms';
@Component({
selector: 'moya-new-organization',
......@@ -7,9 +9,30 @@ import { Component, OnInit } from '@angular/core';
})
export class NewOrganizationComponent implements OnInit {
public organizationForm = new FormGroup({
name: new FormControl(),
address: new FormControl(),
postcode: new FormControl(),
city: new FormControl(),
businessId: new FormControl(),
bankName: new FormControl(),
iban: new FormControl()
});
constructor() { }
ngOnInit() {
}
onSubmit() {
const values = {
'name': this.organizationForm.get('name').value,
'address': this.organizationForm.get('address').value,
'postcode': this.organizationForm.get('postcode').value,
'city': this.organizationForm.get('city').value,
'businessId': this.organizationForm.get('city').value,
'bankName': this.organizationForm.get('bankName').value,
'iban': this.organizationForm.get('iban').value
};
}
}
......@@ -6,19 +6,25 @@ import { EventListComponent } from './event-list/event-list.component';
import {MatSelectModule} from '@angular/material/select';
import {OrganizationListService} from './organization-list/organization-list.service';
import {MatCardModule} from '@angular/material/card';
import {MatButtonModule} from '@angular/material';
import { OrganizationComponent } from './organization.component';
import { FormsModule } from '@angular/forms';
import { EventsService } from './event-list/event-service.service';
import { ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import {MatButtonModule, MatDividerModule} from '@angular/material';
@NgModule({
imports: [
CommonModule,
MatSelectModule,
MatCardModule,
ReactiveFormsModule,
MatInputModule,
MatButtonModule,
MatDividerModule,
FormsModule
],
providers: [OrganizationListService],
providers: [OrganizationListService, EventsService],
declarations: [NewOrganizationComponent, OrganizationListComponent, EventListComponent, OrganizationComponent],
exports: [NewOrganizationComponent, OrganizationListComponent, EventListComponent],
})
......
/* You can add global styles to this file, and also import other style files */
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
\ No newline at end of file
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!