Merge branch 'stylesandmenus' into 'develop'

Stylesandmenus

See merge request !88
parents 50265b51 a5defe55
......@@ -310,4 +310,4 @@ class CASLogin extends ControllerBase
return false;
}
}
}
\ No newline at end of file
......@@ -152,4 +152,4 @@ class CASLogout extends ControllerBase
return new RedirectResponseWithCookieExt($this->redirectUrl .'&error_code=' . $errorCode, 302, []);
}
}
}
}
\ No newline at end of file
......@@ -206,3 +206,12 @@ findcapacity:
_controller: '\Drupal\epal\Controller\DirectorView::findCapacity'
requirements:
_user_is_logged_in: 'TRUE'
findschoolid:
path: '/epal/getschool'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolID'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -687,6 +687,48 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
public function getSchoolID(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schid = intval($user -> init -> value );
$list = array();
$list[] = array(
'id' => $schid
);
$i++;
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} else {
return $this->respondWithStatus([
'message' => t("User not found!"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -156,6 +156,8 @@ import {
public formGroup: FormGroup;
private StudentSelected$: BehaviorSubject<any>;
private StudentSelectedSub: Subscription;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
private StudentInfo$: BehaviorSubject<any>;
private StudentInfoSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
......@@ -167,7 +169,7 @@ import {
private retrievedStudent: BehaviorSubject<boolean>;
private selectionBClass: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147;
private SchoolId ;
private currentclass: Number;
private saved: Array<number> = new Array();
private limitdown = 0;
......@@ -192,6 +194,9 @@ import {
this.retrievedStudent = new BehaviorSubject(false);
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
this.School$ = new BehaviorSubject([{}]);
this.formGroup = this.fb.group({
tomeas: ['', []],
taxi: ['', []],
......@@ -220,10 +225,24 @@ import {
ngOnInit() {
}
this.SchoolSub = this._hds.getSchoolId().subscribe(x => {
this.School$.next(x);
console.log(x[0].id, "schoolid!");
this.SchoolId = x[0].id;
},
error => {
this.School$.next([{}]);
console.log("Error Getting School");
},
() => console.log("Getting School "));
}
verifyclass(txop) {
console.log(this.SchoolId,"schoolida");
this.pageno = 1;
this.retrievedStudent.next(false);
if (txop.value === "1") {
......@@ -275,6 +294,7 @@ import {
checkbclass(tmop, txop) {
console.log(this.SchoolId,"schoolidn");
this.pageno = 1;
this.retrievedStudent.next(false);
var sectorint = +this.formGroup.value.tomeas;
......@@ -321,8 +341,6 @@ import {
}
// this.StudentInfo$ = new BehaviorSubject([{}]);
// this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass).subscribe(this.StudentInfo$);
this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
this.StudentInfo$.next(data);
this.retrievedStudent.next(true);
......@@ -363,9 +381,6 @@ import {
confirmStudent() {
this._hds.saveConfirmStudents(this.saved, this.type);
let event = new MouseEvent('click', { bubbles: true });
this.fileInput.nativeElement.dispatchEvent(event);
}
checkcclass() {
......
......@@ -55,8 +55,11 @@ import {
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
public perfecture = 1;
public perfecture ;
private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
constructor(private fb: FormBuilder,
......@@ -67,6 +70,7 @@ import {
this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.School$ = new BehaviorSubject([{}]);
this.formGroup = this.fb.group({
});
......@@ -77,6 +81,19 @@ import {
ngOnInit() {
this.SchoolSub = this._hds.getSchoolId().subscribe(x => {
this.School$.next(x);
console.log(x[0].id, "perfectureID");
this.perfecture = x[0].id;
},
error => {
this.School$.next([{}]);
console.log("Error Getting School");
},
() => console.log("Getting School "));
this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(this.perfecture).subscribe(data => {
this.SchoolsPerPerf$.next(data);
......
......@@ -20,6 +20,9 @@ import { EPALCLASSES_INITIAL_STATE } from '../../store/epalclasses/epalclasses.i
import { SECTOR_COURSES_INITIAL_STATE } from '../../store/sectorcourses/sectorcourses.initial-state';
import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state';
import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields/studentdatafields.initial-state';
import { ICriteria, ICriter } from '../../store/criteria/criteria.types';
import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-state';
@Component({
selector: 'application-preview-select',
......@@ -77,20 +80,61 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
</li>
</div>
</ul>
<div *ngIf="currentUrl === '/submited-preview'">
<div *ngFor="let studentDataField$ of studentDataFields$ | async;">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Στοιχεία μαθητή
</li>
<li class="list-group-item">
{{studentDataField$.name }}
</li>
<li class="list-group-item">
{{studentDataField$.studentsurname }}
</li>
</ul>
</ul>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" id="name" style="border:1px solid #eceeef;"> {{studentDataField$.name}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" id = "studentsurname" style="border:1px solid #eceeef;"> {{studentDataField$.studentsurname}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{studentDataField$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{studentDataField$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{studentDataField$.studentbirthdate}} </p></div>
<table>
<tr>
<td>
<div class="form-group">
<label for="regionaddress">Διεύθυνση κατοικίας</label><p class="form-control" id = "regionaddress" style="border:1px solid #eceeef;"> {{studentDataField$.regionaddress}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regiontk">TK </label><p class="form-control" id = "regiontk" style="border:1px solid #eceeef;"> {{studentDataField$.regiontk}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regionarea">Πόλη/Περιοχή</label><p class="form-control" id = "regionarea" style="border:1px solid #eceeef;"> {{studentDataField$.regionarea}} </p>
</div>
</td>
</tr>
</table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{studentDataField$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{studentDataField$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{studentDataField$.relationtostudent}} </p></div>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
<div *ngIf="currentUrl === '/submited-preview'">
Κοινωνικά/Εισοδηματικά Κριτήρια
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="currentUrl === '/submited-preview'">
<div *ngFor="let criteriaField$ of criteriaFields$ | async;">
<div *ngIf="criteriaField$.selected === true">
{{criteriaField$.name}}
</div>
</div>
</div>
`
})
......@@ -99,16 +143,19 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
private regions$: BehaviorSubject<IRegions>;
private selectedSchools$: BehaviorSubject<Array<IRegionSchool>> = new BehaviorSubject(Array());
private sectorFields$: BehaviorSubject<ISectorFields>;
private criteriaFields$: BehaviorSubject<ICriter>;
private studentDataFields$: BehaviorSubject<IStudentDataFields>;
private epalclasses$: BehaviorSubject<IEpalClasses>;
private sectorsSub: Subscription;
private regionsSub: Subscription;
private sectorFieldsSub: Subscription;
private criteriaFieldsSub: Subscription;
private studentDataFieldsSub: Subscription;
private courseActive = "-1";
private numSelectedSchools = <number>0;
private numSelectedOrder = <number>0;
private classSelected = 0;
public currentUrl: string;
constructor(private _ngRedux: NgRedux<IAppState>,
private router: Router
......@@ -119,10 +166,12 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
this.sectors$ = new BehaviorSubject(SECTOR_COURSES_INITIAL_STATE);
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
this.criteriaFields$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
};
ngOnInit() {
this.currentUrl = this.router.url;
this.sectorsSub = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) => {
sector.courses.reduce((prevCourse, course) => {
......@@ -175,6 +224,14 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
return state.studentDataFields;
}).subscribe(this.studentDataFields$);
this.criteriaFieldsSub = this._ngRedux.select(state => {
state.criter.reduce(({}, criteriaField) => {
return criteriaField;
}, {});
return state.criter;
}).subscribe(this.criteriaFields$);
this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) => {
if (epalclass.name === "Α' Λυκείου")
......
......@@ -82,6 +82,7 @@ import {AppSettings} from '../../app.settings';
private modalText: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
private showLoader: BehaviorSubject<boolean>;
public currentUrl: string;
constructor(private _ngRedux: NgRedux<IAppState>,
private router: Router,
......@@ -102,7 +103,14 @@ import {AppSettings} from '../../app.settings';
this.showLoader = new BehaviorSubject(false);
};
ngOnInit() {
(<any>$('#studentFormSentNotice')).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
......
......@@ -13,9 +13,7 @@ import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import {Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import * as html2canvas from "html2canvas"
@Component({
selector: 'submited-preview',
template: `
......@@ -31,7 +29,7 @@ import * as html2canvas from "html2canvas"
[class.evenout]="isEven" (click)="setActiveUser(UserData$.id)" [class.selectedout]="userActive === UserData$.id" >
<h5> {{UserData$.name}}&nbsp;{{UserData$.studentsurname}} </h5>
</li>
<div id = "target">
<div #target class = "target "id = "target">
<div *ngFor="let StudentDetails$ of SubmitedDetails$ | async" [hidden]="UserData$.id !== userActive" >
<table>
......@@ -123,6 +121,8 @@ import * as html2canvas from "html2canvas"
public StudentId;
private userActive = <number>-1;
@ViewChild('target') element: ElementRef;
constructor(private _hds: HelperDataService,
private activatedRoute: ActivatedRoute,
private router: Router ,
......@@ -211,39 +211,54 @@ import * as html2canvas from "html2canvas"
}
createPdf1()
createPdf()
{
html2canvas(document.getElementById("target")).then(function(canvas)
{
var img = canvas.toDataURL();
var doc = new jsPDF();
doc.onload = function(){
console.log(img, doc, "lalalalalala");
var img=new Image();
img.src=canvas.toDataURL();
img.onload=function(){
console.log(img,"img");
var doc = new jsPDF();
console.log(img, doc, "ok");
doc.addImage(img, 'PNG',0, 0, 210, 297);
console.log(img, doc, "ok2");
doc.save('applications.pdf');
}
});
}
createPdf()
},
function(error){
console.log("i fail");
});
}
{
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
// Save the PDF
doc.save('Test.pdf');
}
createPdf1()
{
html2canvas(document.getElementById("target"), <Html2Canvas.Html2CanvasOptions>{
onrendered: function(canvas: HTMLCanvasElement) {
console.log("lalalal");
var img = canvas.toDataURL();
var doc = new jsPDF();
doc.addImage(img, 'PNG',0, 0, 210, 297);
doc.save('applications.pdf');
},
function(error){
console.log("i fail");
}
});
}
}
......@@ -922,4 +922,31 @@ getCapacityPerSchool(taxi, tomeas, specialit, schoolid) {
.map(response => response.json());
}
getSchoolId() {
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
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/getschool/`, options)
.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