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

trans

parent 0e06c09f
......@@ -196,3 +196,11 @@ critirioschosen:
_controller: '\Drupal\epal\Controller\SubmitedApplications::getCritiria'
requirements:
_user_is_logged_in: 'TRUE'
findcapacity:
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::findCapacity'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -209,9 +209,13 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
$epalStudent = reset($epalStudents);
if ($epalStudents) {
$studentIdNew = $epalStudent -> id();
$checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array( 'student_id'=> $studentIdNew));
$checkstudentstatus = reset($checkstatus);
if ($i >= $limitdown && $i < $limitup)
{
$newstatus = $checkstudentstatus -> directorconfirm-> getValue();
$list[] = array(
'i' => $i,
'id' => $epalStudent -> id(),
......@@ -222,7 +226,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->value,
'guardianfirstname' =>$epalUser -> name ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'regionaddress' =>$epalStudent -> regionaddress ->value,
'regiontk' =>$epalStudent -> regiontk ->value,
'regionarea' =>$epalStudent -> regionarea ->value,
......@@ -230,6 +234,8 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
'telnum' =>$epalStudent -> telnum ->value,
'relationtostudent' =>$epalStudent -> relationtostudent ->value,
'birthdate' =>$epalStudent -> birthdate ->value,
'checkstatus' =>$newstatus[0][value],
);
}
$i++;
......@@ -290,7 +296,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
{
$postData = json_decode($content);
$arr = $postData->students;
$type = $postData ->type
$type = $postData ->type;
foreach ($arr as $value) {
$valnew = intval($value);
......@@ -299,8 +305,10 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
if ($studentConfirm) {
if ($type == 1)
$studentConfirm->set('directorconfirm', true);
if ($type == 1)
if ($type == 2)
$studentConfirm->set('directorconfirm', false);
if ($type == 3)
unset($studentConfirm->{directorconfirm});
$studentConfirm->save();
}
}
......@@ -330,6 +338,8 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
......@@ -587,6 +597,96 @@ public function returnstatus($id)
}
public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
$tomeasnew = intval($tomeas);
$specialitnew = intval($specialitnew) ;
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $this->testSchoolId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
$response = new Response();
$response->setContent('No access to this school');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
$list = array();
if (($tomeasnew == 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'capacity' => $classcapacity -> capacity_class_a -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $tomeasnew ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'capacity' => $classcapacity -> capacity_class_sector -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew != 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialitnew));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' =>$taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'tomeas' => $classcapacity -> specialty_id -> value,
'capacity' => $classcapacity -> capacity_class_specialty -> value ,
);
}
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} else {
return $this->respondWithStatus([
'message' => t("EPAL user not found"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -36,16 +36,30 @@ import {
</select>
</div>
<div class="form-group">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" formControlName="specialit">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" (change)="checkcclass(tmop,txoption,spop)" formControlName="specialit">
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select>
</div>
<div *ngIf="(retrievedStudent | async) && (modify === false)">
<strong>Δυναμική σε τμήματα:</strong>
<div *ngFor="let classCapac$ of classCapacity$ | async;" >
<div><label for="capc">Τρέχουσα Δυναμική:</label> <p class="form-control" id = "capc" style="border:1px solid #eceeef;"> {{classCapac$.capacity}} </p></div>
</div>
<p style="margin-top: 20px; line-height: 2em;"> Αν θέλετε να αλλάξετε τη δυναμική σε τμήματα για τη συγκεκριμένή επιλογή συνέχεια επιλέξτε <i>Τροποποίηση</i>.</p>
<button type="button" class="btn-primary btn-sm pull-right" (click) ="modifyCapacity()">
Τροποποίηση
</button>
</div>
<div *ngIf="(modify === true)">
<input type="number" formControlName="capacity" min="1" max="10">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()">
Αποθήκευση
</button>
</div>
`
})
......@@ -60,6 +74,10 @@ import {
private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147 ;
private currentclass: Number;
private classCapacity$: BehaviorSubject<any>;
private classCapacitySub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>;
private modify = false;
......@@ -70,8 +88,10 @@ import {
{
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.classCapacity$ = new BehaviorSubject([{}]);
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
this.retrievedStudent = new BehaviorSubject(false);
this.formGroup = this.fb.group({
tomeas: ['', []],
taxi: ['', []],
......@@ -91,17 +111,21 @@ import {
this.selectionBClass.unsubscribe();
if (this.selectionCClass)
this.selectionCClass.unsubscribe();
if (this.classCapacitySub)
this.classCapacitySub.unsubscribe();
if (this.retrievedStudent)
this.retrievedStudent.unsubscribe();
}
ngOnInit() {
this.retrievedStudent.next(false);
}
verifyclass(txop)
{
this.modify = false;
console.log(this.formGroup.value.specialit, "speciality");
if (txop.value === "1")
{
this.selectionBClass.next(false);
......@@ -110,6 +134,15 @@ import {
tomeas: '',
specialit: '',
});
console.log("a class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,0,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
else if (txop.value === "2")
......@@ -136,20 +169,61 @@ import {
this.selectionCClass.next(true);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
}
}
checkbclass(tmop,txop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint,"tomeas");
if (txop.value === "2")
{
console.log("b class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
if (txop.value === "3")
{
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
}
}
checkcclass(tmop,txop,spop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
var specialint = +this.formGroup.value.specialit;
if (txop.value === "3")
{
console.log("c class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,specialint,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
}
......@@ -165,4 +239,9 @@ saveCapacity()
}
modifyCapacity(){
this.modify = true;
}
}
\ No newline at end of file
......@@ -50,7 +50,9 @@ import {
<div *ngIf="(retrievedStudent | async)">
<div *ngFor="let StudentDetails$ of StudentInfo$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(StudentDetails$.i)" [class.selectedout]="userActive === StudentDetails$.i" >
<li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(StudentDetails$.i)"
[class.selectedout]="userActive === StudentDetails$.i" [class.confirmed]="StudentDetails$.checkstatus === '1'"
[class.notconfirmed]="StudentDetails$.checkstatus === '0'" [class.notchecked]="(StudentDetails$.checkstatus !== '1') && (StudentDetails$.checkstatus !== '0')">
<h5> {{StudentDetails$.name}}&nbsp;{{StudentDetails$.name}} </h5>
</li>
......@@ -164,7 +166,7 @@ import {
private currentclass: Number;
private saved: Array<number> = new Array();
private limitdown = 0;
private limitup= 5;
private limitup= 25;
private pageno = 1;
private userActive = <number>-1;
private type: Number;
......@@ -356,6 +358,7 @@ import {
confirmStudent() {
this._hds.saveConfirmStudents(this.saved, this.type);
}
checkcclass() {
......
import {Router, ActivatedRoute, Params} from '@angular/router';
import {OnInit, Component} from '@angular/core';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { NgRedux, select } from 'ng2-redux';
import { Observable } from 'rxjs/Rx';
import { IAppState } from '../../store/store';
import { HelperDataService } from '../../services/helper-data-service';
import { CookieService } from 'ngx-cookie';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray
} from '@angular/forms';
import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../../app.settings';
@Component({
selector: 'director-buttons',
template: `
<div>
<form>
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="navigatedirector()">
Επιλεχθέντες Μαθητές<span class="glyphicon glyphicon-menu-right"></span>
</button>
<br>
<br>
<button type="submit" class="btn-primary btn-lg" (click)="navigatecapacity()">
Δυναμική Τμημάτων<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
<br>
<br>
<br>
<br>
<br>
</form>
</div>
`
})
export default class DirectorButtom implements OnInit {
constructor(
private router: Router,
)
{
};
ngOnInit() {
}
navigatedirector(){
this.router.navigate(['/school/director-view']);
}
navigatecapacity(){
this.router.navigate(['/school/director-classcapacity']);
}
}
......@@ -77,7 +77,7 @@ export default class SchoolHome implements OnInit {
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0)
if (this.authRole = 'director')
this.router.navigate(['/school/director-view']);
this.router.navigate(['/school/director-buttons']);
if (this.authRole = 'pde')
this.router.navigate(['/school/perfecture-view']);
return loginInfoToken;
......
......@@ -190,6 +190,20 @@
color:black!important ;
}
.notchecked {
color: black!important;
}
.confirmed {
color: green!important;
}
.notconfirmed {
color: red!important;
}
.roundedNumber{
width: 2em;
background-color: coral;
......
......@@ -22,6 +22,7 @@ import ApplicationSubmit from '../components/student-application-form/applicatio
import SubmitedPreview from '../components/student-application-form/submited.aplication.preview';
import SubmitedPerson from '../components/student-application-form/submitedstudent.preview';
import DirectorView from '../components/director/director-view';
import DirectorButtons from '../components/director/director.buttons';
import PerfectureView from '../components/infoviews/perfecture-view';
import DirectorClassCapacity from '../components/director/director-classcapacity';
import MinisterView from '../components/minister/minister-view';
......@@ -51,6 +52,7 @@ export const MainRoutes: Routes = [
{ path: 'submited-preview', component: SubmitedPreview, canActivate: [StudentAuthGuard] },
{ path: 'submited-person', component: SubmitedPerson, canActivate: [StudentAuthGuard] },
{ path: 'school/director-view', component: DirectorView, canActivate: [SchoolAuthGuard] },
{ path: 'school/director-buttons', component: DirectorButtons },
{ path: 'school/director-classcapacity', component: DirectorClassCapacity, canActivate: [SchoolAuthGuard] },
{ path: 'ministry/minister-view', component: MinisterView },
{ path: 'ministry/minister-reports', component: MinisterReports },
......@@ -83,5 +85,6 @@ export const MainDeclarations = [
MinisterReports,
InformStudents,
PerfectureView,
Breadcrubs
Breadcrubs,
DirectorButtons
];
......@@ -768,4 +768,21 @@ export class HelperDataService implements OnInit, OnDestroy {
}
getCapacityPerSchool(taxi, tomeas, specialit, schoolid) {
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/findCapacity/` + taxi + '/' + tomeas + '/' + specialit + '/' + schoolid, 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