Review reports 0,1

parent 744c333c
......@@ -147,7 +147,7 @@ epal.ministry.general_report:
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\ReportsCreator::makegGeneralReport'
_controller: '\Drupal\epal\Controller\ReportsCreator::makeGeneralReport'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.report-completeness:
......
import { Component, OnInit, OnDestroy } from "@angular/core";
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import { AppSettings } from "../../app.settings";
import { HelperDataService } from "../../services/helper-data-service";
import { Observable} from "rxjs/Observable";
import { Http, Headers, RequestOptions} from '@angular/http';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import { MINISTRY_ROLE, PDE_ROLE, DIDE_ROLE } from '../../constants';
import { Http, Headers, RequestOptions} from "@angular/http";
import { NgRedux, select } from "ng2-redux";
import { IAppState } from "../../store/store";
import { Router, ActivatedRoute, Params} from "@angular/router";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { ILoginInfo } from "../../store/logininfo/logininfo.types";
import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state";
import { MINISTRY_ROLE, PDE_ROLE, DIDE_ROLE } from "../../constants";
import {
FormBuilder,
......@@ -18,13 +18,13 @@ import {
FormControl,
FormArray,
Validators,
} from '@angular/forms';
} from "@angular/forms";
import { API_ENDPOINT } from '../../app.settings';
import { API_ENDPOINT } from "../../app.settings";
@Component({
selector: 'minister-reports',
//encapsulation: ViewEncapsulation.None,
selector: "minister-reports",
// encapsulation: ViewEncapsulation.None,
template: `
......@@ -35,34 +35,6 @@ import { API_ENDPOINT } from '../../app.settings';
<div class="col-md-1">
<!--
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(1)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide'" >
<i class="fa fa-file-text"></i>
Κατανομή Μαθητών με Βάση τη Σειρά Προτίμησης
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(2)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Συνολική Πληρότητα σχολικών μονάδων ΕΠΑΛ ανά τάξη
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(3)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Αριθμός Μαθητών και Πληρότητα σχολικών μονάδων ΕΠΑΛ
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(4)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide' " >
<i class="fa fa-file-text"></i>
Σχολικές μονάδες που δεν έχουν δηλώσει Χωρητικότητα τμημάτων
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(5)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide' " >
<i class="fa fa-file-text"></i>
Ολιγομελή τμήματα (Προσωρινά τοποθετημένοι μαθητές)
</button>
<br><br>
</div>
-->
<div *ngIf = "minedu_userName != '' && userRole != 'pde' && userRole != 'dide'">
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(0)" >
<i class="fa fa-file-text"></i>
......@@ -131,13 +103,13 @@ import { API_ENDPOINT } from '../../app.settings';
private router: Router) {
this.formGroup = this.fb.group({
region: ['', []],
adminarea: ['', []],
schoollist: ['', []],
region: ["", []],
adminarea: ["", []],
schoollist: ["", []],
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.minedu_userName = '';
this.minedu_userName = "";
this.userRole = MINISTRY_ROLE;
}
......@@ -149,7 +121,7 @@ import { API_ENDPOINT } from '../../app.settings';
state.loginInfo.reduce(({}, loginInfoToken) => {
this.minedu_userName = loginInfoToken.minedu_username;
this.minedu_userPassword = loginInfoToken.minedu_userpassword;
if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) {
if (loginInfoToken.auth_role === PDE_ROLE || loginInfoToken.auth_role === DIDE_ROLE) {
this.userRole = loginInfoToken.auth_role;
this.minedu_userName = loginInfoToken.auth_token;
this.minedu_userPassword = loginInfoToken.auth_token;
......@@ -163,25 +135,24 @@ import { API_ENDPOINT } from '../../app.settings';
}
ngOnDestroy() {
if (this.loginInfoSub)
if (this.loginInfoSub) {
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
}
if (this.loginInfo$) {
this.loginInfo$.unsubscribe();
}
}
nav_to_reportpath(repId) {
if (repId == 0)
this.router.navigate(['/ministry/report-users', repId]);
if (repId == 1)
this.router.navigate(['/ministry/report-general', repId]);
else if (repId == 2 || repId == 3 || repId == 5)
this.router.navigate(['/ministry/report-all-stat', repId]);
else if (repId == 4)
this.router.navigate(['/ministry/report-no-capacity', repId]);
if (repId === 0) {
this.router.navigate(["/ministry/report-users", repId]);
} else if (repId === 1) {
this.router.navigate(["/ministry/report-general"]);
} else if (repId === 2 || repId === 3 || repId === 5) {
this.router.navigate(["/ministry/report-all-stat", repId]);
} else if (repId === 4) {
this.router.navigate(["/ministry/report-no-capacity", repId]);
}
}
}
import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Input } from "@angular/core";
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import { Observable} from "rxjs/Observable";
import { Http, Headers, RequestOptions} from '@angular/http';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { Ng2SmartTableModule, LocalDataSource } from 'ng2-smart-table';
import {reportsSchema, TableColumn} from './reports-schema';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import {csvCreator} from './csv-creator';
import {chartCreator} from './chart-creator';
import { AppSettings } from "../../app.settings";
import { HelperDataService } from "../../services/helper-data-service";
import { Observable } from "rxjs/Observable";
import { Http, Headers, RequestOptions } from "@angular/http";
import { NgRedux, select } from "ng2-redux";
import { IAppState } from "../../store/store";
import { Router, ActivatedRoute, Params } from "@angular/router";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { ILoginInfo } from "../../store/logininfo/logininfo.types";
import { Ng2SmartTableModule, LocalDataSource } from "ng2-smart-table";
import { reportsSchema, TableColumn } from "./reports-schema";
import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state";
import { csvCreator } from "./csv-creator";
import { chartCreator } from "./chart-creator";
import {
FormBuilder,
......@@ -21,13 +21,12 @@ import {
FormControl,
FormArray,
Validators,
} from '@angular/forms';
} from "@angular/forms";
import { API_ENDPOINT } from '../../app.settings';
import { API_ENDPOINT } from "../../app.settings";
@Component({
selector: 'report-general',
selector: "report-general",
template: `
<div>
......@@ -40,7 +39,7 @@ import { API_ENDPOINT } from '../../app.settings';
<h5> >Επιλογή Φίλτρων <br><br></h5>
<h6> Δεν υπάρχουν διαθέσιμα φίλτρα <br><br><br></h6>
<button type="submit" class="btn btn-alert" (click)="createReport(regsel)" [hidden]="minedu_userName == ''" >
<button type="submit" class="btn btn-alert" (click)="createReport()" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Δημιουργία Αναφοράς
</button>
......@@ -89,8 +88,6 @@ import { API_ENDPOINT } from '../../app.settings';
private data;
private validCreator: number;
private createGraph: boolean;
private reportId: number;
private routerSub: any;
private source: LocalDataSource;
columnMap: Map<string, TableColumn> = new Map<string, TableColumn>();
......@@ -99,7 +96,7 @@ import { API_ENDPOINT } from '../../app.settings';
private csvObj = new csvCreator();
private chartObj = new chartCreator();
@ViewChild('chart') public chartContainer: ElementRef;
@ViewChild("chart") public chartContainer: ElementRef;
private d3data: Array<any>;
......@@ -110,14 +107,14 @@ import { API_ENDPOINT } from '../../app.settings';
private router: Router) {
this.formGroup = this.fb.group({
region: ['', []],
adminarea: ['', []],
schoollist: ['', []],
region: ["", []],
adminarea: ["", []],
schoollist: ["", []],
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.generalReport$ = new BehaviorSubject([{}]);
this.minedu_userName = '';
this.minedu_userName = "";
this.validCreator = -1;
this.createGraph = false;
......@@ -127,7 +124,7 @@ import { API_ENDPOINT } from '../../app.settings';
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
state.loginInfo.reduce(({ }, loginInfoToken) => {
this.minedu_userName = loginInfoToken.minedu_username;
this.minedu_userPassword = loginInfoToken.minedu_userpassword;
return loginInfoToken;
......@@ -136,11 +133,6 @@ import { API_ENDPOINT } from '../../app.settings';
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.routerSub = this.activatedRoute.params.subscribe(params => {
this.reportId = +params['reportId'];
});
}
ngOnDestroy() {
......@@ -156,41 +148,28 @@ import { API_ENDPOINT } from '../../app.settings';
}
createReport(regionSel) {
createReport() {
this.validCreator = 0;
this.createGraph = false;
let route;
if (this.reportId === 1) {
route = "/ministry/general-report/";
this.settings = this.reportSchema.genReportSchema;
}
else if (this.reportId === 2) {
route = "/ministry/report-completeness/";
this.settings = this.reportSchema.reportCompletenessSchema;
}
else if (this.reportId === 3) {
route = "/ministry/report-all-stat/";
this.settings = this.reportSchema.reportAllStatSchema;
}
let regSel = 0;
this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, route, 0, 0, 0, 0, 0, 0, 0).subscribe(data => {
this.generalReport$.next(data);
this.data = data;
this.validCreator = 1;
this.source = new LocalDataSource(this.data);
this.columnMap = new Map<string, TableColumn>();
//pass parametes to csv class object
this.csvObj.columnMap = this.columnMap;
this.csvObj.source = this.source;
this.csvObj.settings = this.settings;
this.csvObj.prepareColumnMap();
},
let route = "/ministry/general-report/";
this.settings = this.reportSchema.genReportSchema;
this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, route, 0, 0, 0, 0, 0, 0, 0)
.subscribe(data => {
this.generalReport$.next(data);
this.data = data;
this.validCreator = 1;
this.source = new LocalDataSource(this.data);
this.columnMap = new Map<string, TableColumn>();
// pass parametes to csv class object
this.csvObj.columnMap = this.columnMap;
this.csvObj.source = this.source;
this.csvObj.settings = this.settings;
this.csvObj.prepareColumnMap();
},
error => {
this.generalReport$.next([{}]);
this.validCreator = -1;
......@@ -200,20 +179,15 @@ import { API_ENDPOINT } from '../../app.settings';
}
navigateBack() {
this.router.navigate(['/ministry/minister-reports']);
this.router.navigate(["/ministry/minister-reports"]);
}
onSearch(query: string = '') {
onSearch(query: string = "") {
this.csvObj.onSearch(query);
}
export2Csv() {
this.csvObj.export2Csv();
}
......@@ -229,33 +203,20 @@ import { API_ENDPOINT } from '../../app.settings';
}
generateGraphData() {
this.d3data = [];
if (this.reportId === 1) {
let labelsX = [];
labelsX.push("1η Προτίμηση");
labelsX.push("2η Προτίμηση");
labelsX.push("3η Προτίμηση");
labelsX.push("Μη τοποθετημένοι");
labelsX.push("Προσωρινά τοποθετημένοι σε ολιγομελή");
for (let i = 1; i <= 5; i++) {
this.d3data.push([
labelsX[i - 1],
this.data[i].numStudents / this.data[0].numStudents,
]);
}
let labelsX = [];
labelsX.push("1η Προτίμηση");
labelsX.push("2η Προτίμηση");
labelsX.push("3η Προτίμηση");
labelsX.push("Μη τοποθετημένοι");
labelsX.push("Προσωρινά τοποθετημένοι σε ολιγομελή");
for (let i = 1; i <= 5; i++) {
this.d3data.push([
labelsX[i - 1],
this.data[i].numStudents / this.data[0].numStudents,
]);
}
}
}
import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Input } from "@angular/core";
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import { AppSettings } from "../../app.settings";
import { HelperDataService } from "../../services/helper-data-service";
import { Observable} from "rxjs/Observable";
import { Http, Headers, RequestOptions} from '@angular/http';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { Ng2SmartTableModule, LocalDataSource } from 'ng2-smart-table';
import {reportsSchema, TableColumn} from './reports-schema';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import {csvCreator} from './csv-creator';
import { API_ENDPOINT } from '../../app.settings';
import { Http, Headers, RequestOptions} from "@angular/http";
import { NgRedux, select } from "ng2-redux";
import { IAppState } from "../../store/store";
import { Router, ActivatedRoute, Params} from "@angular/router";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { ILoginInfo } from "../../store/logininfo/logininfo.types";
import { Ng2SmartTableModule, LocalDataSource } from "ng2-smart-table";
import {reportsSchema, TableColumn} from "./reports-schema";
import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state";
import {csvCreator} from "./csv-creator";
import { API_ENDPOINT } from "../../app.settings";
@Component({
selector: 'report-users',
selector: "report-users",
template: `
<div>
......@@ -66,7 +66,7 @@ import { API_ENDPOINT } from '../../app.settings';
private distStatus = "READY";
private data;
private validCreator: number;
//private reportId: number;
// private reportId: number;
private routerSub: any;
private source: LocalDataSource;
......@@ -75,17 +75,16 @@ import { API_ENDPOINT } from '../../app.settings';
private reportSchema = new reportsSchema();
private csvObj = new csvCreator();
constructor(private _ngRedux: NgRedux<IAppState>,
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService,
private activatedRoute: ActivatedRoute,
private router: Router) {
private router: Router
) {
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.generalReport$ = new BehaviorSubject([{}]);
this.minedu_userName = '';
this.minedu_userName = "";
this.validCreator = -1;
}
ngOnInit() {
......@@ -120,23 +119,23 @@ import { API_ENDPOINT } from '../../app.settings';
this.validCreator = 0;
let route;
route = "/ministry/report-users/";
let route = "/ministry/report-users/";
this.settings = this.reportSchema.ReportUsersSchema;
this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, route, 0, 0, 0, 0, 0, 0, 0).subscribe(data => {
this.generalReport$.next(data);
this.data = data;
this.validCreator = 1;
this.source = new LocalDataSource(this.data);
this.columnMap = new Map<string, TableColumn>();
//pass parametes to csv class object
this.csvObj.columnMap = this.columnMap;
this.csvObj.source = this.source;
this.csvObj.settings = this.settings;
this.csvObj.prepareColumnMap();
},
this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, route, 0, 0, 0, 0, 0, 0, 0)
.subscribe(data => {
this.generalReport$.next(data);
this.data = data;
this.validCreator = 1;
this.source = new LocalDataSource(this.data);
this.columnMap = new Map<string, TableColumn>();
// pass parametes to csv class object
this.csvObj.columnMap = this.columnMap;
this.csvObj.source = this.source;
this.csvObj.settings = this.settings;
this.csvObj.prepareColumnMap();
},
error => {
this.generalReport$.next([{}]);
this.validCreator = -1;
......@@ -146,20 +145,15 @@ import { API_ENDPOINT } from '../../app.settings';
}
navigateBack() {
this.router.navigate(['/ministry/minister-reports']);
this.router.navigate(["/ministry/minister-reports"]);
}
onSearch(query: string = '') {
onSearch(query: string = "") {
this.csvObj.onSearch(query);
}
export2Csv() {
this.csvObj.export2Csv();
}
}
......@@ -77,7 +77,7 @@ export const MainRoutes: Routes = [
{ path: 'ministry/minister-view', component: MinisterView, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/minister-reports', component: MinisterReports, canActivate: [ReportsAuthGuard] },
{ path: 'ministry/report-all-stat/:reportId', component: ReportAllStat, canActivate: [ReportsAuthGuard] },
{ path: 'ministry/report-general/:reportId', component: ReportGeneral, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-general', component: ReportGeneral, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-users/:reportId', component: ReportUsers, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-no-capacity/:reportId', component: ReportNoCapacity, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/minister-informstudents', component: InformStudents, canActivate: [MinistryAuthGuard] },
......
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