64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import { Component, Input, ViewChild } from '@angular/core';
|
|
import { Location } from '@angular/common';
|
|
import {ActivatedRoute} from '@angular/router';
|
|
import { EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
|
|
|
import {InviteService} from './invite.service';
|
|
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
|
@Component({
|
|
selector: 'invite',
|
|
template: `
|
|
<form class="uk-form-stacked">
|
|
<div>
|
|
<label class="uk-form-label">Subject</label>
|
|
<input type="text" placeholder="Subject" [(ngModel)]=subject name="subject">
|
|
</div>
|
|
<div>
|
|
<div class="uk-form-label">Message</div>
|
|
<textarea cols="" rows="6" placeholder="Email message..." [(ngModel)]=body name="body"></textarea>
|
|
</div>
|
|
<a class="uk-button uk-button-primary" (click)="invite()"> Invite</a>
|
|
</form>
|
|
|
|
`
|
|
})
|
|
|
|
export class InviteComponent {
|
|
@Input() communityName:boolean;
|
|
@Input() communityId:string;
|
|
properties:EnvProperties;
|
|
|
|
subject:string;
|
|
body:string;
|
|
recipients:string[] = [];
|
|
|
|
constructor (private route: ActivatedRoute,
|
|
private _inviteService: InviteService
|
|
) {
|
|
}
|
|
|
|
public ngOnInit() {
|
|
this.route.data
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
this.properties = data.envSpecific;
|
|
this.subject = "["+this.communityName+"] Invitation to join community";
|
|
this.body = "Dear sir or madame, \n\nWe would like to invite you to join "+this.communityName +
|
|
" OpenAIRE community (beta."+this.communityId+".openaire.eu)";
|
|
});
|
|
|
|
|
|
}
|
|
|
|
invite(){
|
|
var email = Session.getUserEmail();
|
|
//TODO
|
|
this._inviteService.inviteUsers( this.properties.adminToolsAPIURL,this.subject, this.body, ["argirok@di.uoa.gr"]).subscribe (
|
|
res => {
|
|
console.log(res);
|
|
|
|
});
|
|
}
|
|
|
|
|
|
}
|