Commit 68594917 authored by Open Source Developer's avatar Open Source Developer

transfer

parent ec3b845d
......@@ -15,7 +15,7 @@ current_user:
requirements:
_user_is_logged_in: 'TRUE'
submitedapplications:
path: '/epal/subapplic'
path: '/epal/subapplic/{$studentid}'
options:
_auth: [ 'basic_auth' ]
defaults:
......
......@@ -34,7 +34,7 @@ class SubmitedApplications extends ControllerBase
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid => $epalUser -> user_id -> entity ->id();
$userid = $epalUser -> user_id -> entity ->id();
$epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('user_id' => $userid));
$epalStudent = reset($epalStudents);
......@@ -49,7 +49,26 @@ class SubmitedApplications extends ControllerBase
'message' => t("EPAL user not found"),
], Response::HTTP_FORBIDDEN);
}
if ($studentid){
$StudentSelection = $this->entityTypeManager->getStorage('epal_student_epal_chosen')->loadByProperties(array('student_id' => $studentid, 'user_id' => $userid ));
$StudentSel = reset($StudentSelection);
if ($StudentSel) {
return $this->respondWithStatus([
'epal_id' => $epalStudent ->epal_id->entity->getEpal_id(),
], Response::HTTP_OK);
}
else {
return $this->respondWithStatus([
'message' => t("SpecificStudent not found"),
], Response::HTTP_FORBIDDEN);
}
}
} else {
return $this->respondWithStatus([
'message' => t("EPAL user not found"),
......
......@@ -11,52 +11,56 @@ import {Removetags} from '../../pipes/removehtmltags';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import {Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
@Component({
selector: 'submited-preview',
template: `
<div id = "target">
Έχετε ολοκληρώσει την αίτηση για εγγραφή στην επαγγελπατική εκπαίδευση των παρακάτω ατόμων:
<div *ngFor="let userdata$ of submitedusers$ | async; ">
<br>
<br>
<strong>Στοιχεία υποψηφίου μαθητή: </strong> <br>
<br>
</div>
</div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
<h5 style="margin-top: 20px; line-height: 2em; ">Έχετε ολοκληρώσει την αίτηση για εγγραφή στην επαγγελπατική εκπαίδευση των παρακάτω ατόμων:</h5>
<div *ngFor="let userdata$ of submitedapplic$ | async; ">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Μαθητής: {{userdata$.name}}
</li>
</ul>
</div>
<button type="submit" (click)="studentpreview()"> Λεπτομέρειες
</button>
`
})
@Injectable() export default class SubmitedPreview implements OnInit {
public submitedapplic$: any;
public submitedusers$:any;
public html2canvas: any;
private loginInfo$: Observable<ILoginInfo>;
private user :string;
private submitedapplic$: BehaviorSubject<any>;
private submitedusers$: Subscription;
public studentid = 1 ;
constructor(private _hds: HelperDataService,
public http: Http,
private _ngRedux: NgRedux<IAppState>,)
public http: Http,
private _ngRedux: NgRedux<IAppState>,
private activatedRoute: ActivatedRoute,
private router: Router )
{
this.submitedapplic$ = new BehaviorSubject({});
}
ngOnInit() {
this.submitedusers$ = this._hds.getSubmittedPreviw(0).subscribe(this.submitedapplic$);
console.log("subscription", this.submitedusers$, "behavior", this.submitedapplic$);
}
......@@ -74,4 +78,12 @@ import { ILoginInfo } from '../../store/logininfo/logininfo.types';
);
}
studentpreview()
{
console.log(this.studentid);
this.router.navigate(['/submited-person', { id: this.studentid}]);
}
}
\ No newline at end of file
import { Component, OnInit, ElementRef, ViewChild} from "@angular/core";
let jsPDF = require('jspdf');
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import {Observable} from "rxjs/Observable";
import {IStudentDataFields, IStudentDataField} from '../../store/studentdatafields';
import {Http, Headers, RequestOptions} from '@angular/http';
import * as html2canvas from "html2canvas"
import {Removetags} from '../../pipes/removehtmltags';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import {Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
@Component({
selector: 'submited-person',
template: `
<h5 style="margin-top: 20px; line-height: 2em; ">Στοιχεία Μαθητή</h5>
<div *ngFor="let userdata$ of submitedapplic$ | async; ">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Μαθητής: {{userdata$.name}}
</li>
</ul>
</div>
`
})
@Injectable() export default class SubmitedPerson implements OnInit {
public html2canvas: any;
private submitedapplic$: BehaviorSubject<any>;
private submitedusers$: Subscription;
public userid: number;
public authToken : string ;
constructor(private _hds: HelperDataService,
public http: Http,
private _ngRedux: NgRedux<IAppState>,
private activatedRoute: ActivatedRoute )
{
this.submitedapplic$ = new BehaviorSubject({});
}
ngOnInit() {
this.activatedRoute.queryParams.subscribe((params: Params) => {
if (params) {
this.userid = 1;
console.log("userid", this.userid, this.authToken);
}
});
this.submitedusers$ = this._hds.getSubmittedPreviw(this.userid).subscribe(this.submitedapplic$);
console.log("subscription", this.submitedusers$, "behavior", this.submitedapplic$);
}
createPdf()
{
html2canvas(document.getElementById("target")).then(function(canvas)
{
var img = canvas.toDataURL();
var doc = new jsPDF('p', 'mm');
doc.addImage(img, 'PNG', 10, 10);
doc.save('applications.pdf');
}
);
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ import ApplicationPreview from '../components/student-application-form/applicati
import SchoolsOrderSelect from '../components/student-application-form/schools-order-select';
import ApplicationSubmit from '../components/student-application-form/application.submit';
import SubmitedPreview from '../components/student-application-form/submited.aplication.preview';
import SubmitedPerson from '../components/student-application-form/submitedstudent.preview';
export const MainRoutes: Routes = [
{ path: '', component: Home },
......@@ -34,6 +34,7 @@ export const MainRoutes: Routes = [
{ path: 'schools-order-select', component: SchoolsOrderSelect },
{ path: 'application-submit', component: ApplicationSubmit },
{ path: 'submited-preview', component: SubmitedPreview },
{ path: 'submited-person', component: SubmitedPerson },
];
export const MainDeclarations = [
......@@ -52,4 +53,5 @@ export const MainDeclarations = [
SchoolsOrderSelect,
ApplicationSubmit,
SubmitedPreview,
SubmitedPerson
];
......@@ -331,4 +331,21 @@ transformUserSchema(userlogin:any,oauthtoken:string, oauthrole:string){
}
getSubmittedPreviw(stud_id) {
this.loginInfo$.forEach(loginInfoToken => {
this.authToken = loginInfoToken.get(0).auth_token;
});
let headers = new Headers({
"Content-Type": "application/json",
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/subapplic`, options , {params:{"param1": stud_id}})
.map(response => response.json());
}
}
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