SmallClassesApprov

parent 0c4fbc6c
......@@ -189,7 +189,7 @@ epal.ministry.retrievesettings:
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.storesettings:
path: '/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsAppModifyDisabled}/{applicantsAppDeleteDisabled}/{applicantsResultsDisabled}/{secondPeriodEnabled}/{dateStart}'
path: '/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsAppModifyDisabled}/{applicantsAppDeleteDisabled}/{applicantsResultsDisabled}/{secondPeriodEnabled}/{dateStart}/{smallClassApproved}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -403,4 +403,44 @@ epal.approveclasses:
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::ApproveClasses'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
_user_is_logged_in: 'TRUE'
epal.locksmallclasses:
path: '/epal/locksmallclasses'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::FindSmallClassesApproved'
requirements:
_user_is_logged_in: 'TRUE'
epal.getregions:
path: '/epal/getregions'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::GetRegions'
requirements:
_user_is_logged_in: 'TRUE'
epal.sectorsperschool:
path: '/epal/sectorsperschool/{courseActive}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::GetSectorsperschool'
requirements:
_user_is_logged_in: 'TRUE'
epal.getcoursesperschoolsmallclasses:
path: '/epal/getcoursesperschoolsmallclasses/{courseActive}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::getCoursesPerSchoolSmallClasses'
requirements:
_user_is_logged_in: 'TRUE'
epal.getcoursesperschoolsmallclasses_night:
path: '/epal/getcoursesperschoolsmallclasses_night/{courseActive}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::getCoursesPerSchoolSmallClassesNight'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -103,6 +103,7 @@ class MinisterSettings extends ControllerBase {
$applicantsResultsDisabled = $epalConfig->lock_results->getString();
$secondPeriodEnabled = $epalConfig->activate_second_period->getString();
$dateStart = $epalConfig->date_start_b_period->getString();
$smallClassApproved = $epalConfig->lock_small_classes->getString();
}
$config_storage->resetCache();
......@@ -116,6 +117,7 @@ class MinisterSettings extends ControllerBase {
'applicantsResultsDisabled' => $applicantsResultsDisabled,
'secondPeriodEnabled' => $secondPeriodEnabled,
'dateStart' => $dateStart,
'smallClassApproved' => $smallClassApproved
], Response::HTTP_OK);
} //end try
......@@ -133,10 +135,11 @@ class MinisterSettings extends ControllerBase {
public function storeSettings(Request $request, $capacityDisabled, $directorViewDisabled, $applicantsLoginDisabled, $applicantsAppModifyDisabled,
$applicantsAppDeleteDisabled, $applicantsResultsDisabled, $secondPeriodEnabled, $dateStart ) {
$applicantsAppDeleteDisabled, $applicantsResultsDisabled,
$secondPeriodEnabled, $dateStart, $smallClassApproved ) {
try {
if (!$request->isMethod('GET')) {
if (!$request->isMethod('GET')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
], Response::HTTP_METHOD_NOT_ALLOWED);
......@@ -175,7 +178,8 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
], Response::HTTP_FORBIDDEN);
}
else {
$epalConfig->set('lock_school_capacity', $capacityDisabled);
$epalConfig->set('lock_school_capacity', $capacityDisabled);
$epalConfig->set('lock_school_students_view', $directorViewDisabled);
$epalConfig->set('lock_application', $applicantsLoginDisabled);
$epalConfig->set('lock_modify', $applicantsAppModifyDisabled);
......@@ -183,7 +187,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
$epalConfig->set('lock_results', $applicantsResultsDisabled);
$epalConfig->set('activate_second_period', $secondPeriodEnabled);
$epalConfig->set('date_start_b_period', $dateStart);
$epalConfig->set('lock_small_classes', $smallClassApproved);
$epalConfig->save();
}
$config_storage->resetCache();
......@@ -199,6 +203,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
'applicantsResultsDisabled' => $applicantsResultsDisabled,
'secondPeriodEnabled' => $secondPeriodEnabled,
'dateStart' => $dateStart,
'smallClassApproved' =>$smallClassApproved,
], Response::HTTP_OK);
} //end try
......
......@@ -356,6 +356,26 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['lock_small_classes'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Ενεργοποίηση της επιλογής για περιορισμό των μη εγκεκριμένων ολιγομελών τμημάτων'))
->setDescription(t('Ενεργοποίηση της επιλογής για περιορισμό των μη εγκεκριμένων ολιγομελών τμημάτων'))
->setSettings(array(
'text_processing' => 0,
))
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'boolean',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Epal config is published.'))
......
......@@ -145,6 +145,12 @@ class EepalSchool extends ContentEntityBase implements EepalSchoolInterface {
return $this;
}
public function getperfecture() {
return $this->get('region_edu_admin_id')->target_id;
}
/**
* {@inheritdoc}
*/
......
......@@ -25,10 +25,12 @@ import { HelperDataService } from "../../services/helper-data-service";
</div>
</div>
</div>
<div style="min-height: 500px;">
<div style="min-height: 500px;">
<form>
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
<br/>Επιλέξτε σχολείο για να εμφανιστούν τα τμήματα του σχολείου.</p>
<br/>Επιλέξτε σχολείο για να εμφανιστούν τα ολιγομελή τμήματα του σχολείου.</p>
<div class="row" style="margin-top: 20px; line-height: 2em;"><p><strong>Τα τμήματα</strong></p></div>
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" style="font-size: 0.8em; font-weight: bold;">
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)"
......@@ -36,39 +38,48 @@ import { HelperDataService } from "../../services/helper-data-service";
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div [class.changelistcolor]= "SchoolNames$.status === false" class="col-md-12">{{SchoolNames$.name}}</div>
<div class = "row" [hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-10">Τμήματα</div>
<div class="col-md-2">Εγγεκριμένο</div>
<div class="col-md-8">Τμήματα</div>
<div class="col-md-4">Έγκριση Ολιγομελούς</div>
</div>
</li>
<p></p>
<div class = "row" [hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-8">&nbsp;</div>
<div [hidden]="SchoolNames$.id !== regionActive" class="col-md-4 pull-right" style="color: black;" >
<span aria-hidden="true">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="setActiveRegion(SchoolNames$.id)">Κλείσιμο</button>
</span>
</div>
</div>
</li>
<div class="col-md-8">&nbsp;</div>
<div [hidden]="SchoolNames$.id !== regionActive" class="col-md-4 pull-right" style="color: black;" >
<span aria-hidden="true">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="setActiveRegion(SchoolNames$.id)">Κλείσιμο</button>
</span>
</div>
<div class = "row" *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even"
[class.oddin]="isOdd2" [class.evenin]="isEven2"
[class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.changecolorbalck]="calccolor(CoursesNames$.limitdown, CoursesNames$.size)"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" >
[hidden]="(SchoolNames$.id !== regionActive) ||(calccolor(CoursesNames$.size,CoursesNames$.limitdown) === false) "
style="margin: 0px 2px 0px 2px;" >
<div class="row" style="margin-bottom: 20px;" *ngIf ="calccolor(CoursesNames$.size,CoursesNames$.limitdown) === true">
<div class="col-md-6">{{CoursesNames$.name}}</div>
<div class="col-md-4 pull-right">
<div class="col-md-8">{{CoursesNames$.name}}</div>
<div class="col-md-4">
<strong><label>Έγκριση Ολιγομελούς:</label> </strong>
<select class="form-control pull-right" #cb name="{{CoursesNames$.id}}" (change)="confirmApproved(CoursesNames$.classes,CoursesNames$.approved_id, cb, j)" >
<option value="1" [selected]="CoursesNames$.approved === '1' ">Ναι</option>
<option value="2" [selected]="CoursesNames$.approved === '0' ">Όχι</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
`
})
......
......@@ -134,6 +134,16 @@ import { IAppState } from "../../store/store";
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-1 ">
<input type="checkbox" [checked]="smallClassApproved" formControlName="smallClassApproved"
(click)="toggleSmallClassesFilter()" >
</div>
<div class="col-md-9">
<label for="smallClassApproved">Ενεργοποίηση της επιλογής για περιορισμό των μη εγκεκριμένων ολιγομελών τμημάτων</label>
</div>
</div>
<br>
<button type="submit" class="btn btn-md pull-right" (click)="storeSettings()" [disabled] = "secondPeriodEnabled && formGroup.get('distributionstartdate').hasError('required')" >
......@@ -166,6 +176,7 @@ import { IAppState } from "../../store/store";
private secondPeriodEnabled: boolean;
private dateStartBPeriod: string;
private dataRetrieved: number;
private smallClassApproved: boolean;
private minedu_userName: string;
private minedu_userPassword: string;
......@@ -191,6 +202,7 @@ import { IAppState } from "../../store/store";
applicantsResultsDisabled: ["", []],
secondPeriodEnabled: ["", []],
distributionstartdate:["", [Validators.required]],
smallClassApproved:["",[]],
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
......@@ -259,6 +271,7 @@ import { IAppState } from "../../store/store";
this.applicantsResultsDisabled = Boolean(Number(this.settings$.value["applicantsResultsDisabled"]));
this.secondPeriodEnabled = Boolean(Number(this.settings$.value["secondPeriodEnabled"]));
this.dateStartBPeriod = this.settings$.value["dateStart"];
this.smallClassApproved = Boolean(Number(this.settings$.value["smallClassApproved"]))
if (this.dateStartBPeriod != '') {
let dateparts = this.dateStartBPeriod.split("-",3);
this.formGroup.controls["distributionstartdate"].setValue( {date: {year: Number(dateparts[2]), month: Number(dateparts[1]), day: Number(dateparts[0])}} );
......@@ -290,7 +303,7 @@ import { IAppState } from "../../store/store";
this.settingsSub = this._hds.storeAdminSettings(this.minedu_userName, this.minedu_userPassword,
this.capacityDisabled, this.directorViewDisabled, this.applicantsLoginDisabled,
this.applicantsAppModifyDisabled, this.applicantsAppDeleteDisabled, this.applicantsResultsDisabled,
this.secondPeriodEnabled, this.dateStartBPeriod)
this.secondPeriodEnabled, this.dateStartBPeriod, this.smallClassApproved)
.subscribe(data => {
this.settings$.next(data);
this.dataRetrieved = 1;
......@@ -340,4 +353,9 @@ import { IAppState } from "../../store/store";
this.secondPeriodEnabled = !this.secondPeriodEnabled;
}
toggleSmallClassesFilter(){
this.smallClassApproved =!this.smallClassApproved;
console.log(this.smallClassApproved,'aaaaa');
}
}
......@@ -21,7 +21,7 @@ import { IAppState } from "../../store/store";
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="!(regions$ | async) || (regions$ | async).size===0">
<div class = "loading" *ngIf="!(regions$ | async) ">
</div>
<!-- <div class="row equal">
<div class="col-md-12"> -->
......
......@@ -30,16 +30,20 @@ export class HelperDataService implements OnInit, OnDestroy {
private authToken: string;
private loginInfoSub: Subscription;
private lockApprovSub: Subscription;
private authRole: string;
private minedu_userName: string;
private minedu_userPassword: string;
private loginInfo$: BehaviorSubject<ILoginInfoRecords>;
private lockApprov$: BehaviorSubject<any>;
private lockapp: number;
constructor(
private http: Http,
private _ngRedux: NgRedux<IAppState>,
private _cookieService: CookieService) {
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.lockApprov$ = new BehaviorSubject([{}]);
};
ngOnInit() {
......@@ -220,24 +224,59 @@ export class HelperDataService implements OnInit, OnDestroy {
return new Promise((resolve, reject) => {
let getConnectionString = null;
if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/regions/list`;
else if (classActive === 2)
getConnectionString = `${AppSettings.API_ENDPOINT}/sectorsperschool/list?sector_id=${courseActive}`;
else if (classActive === 3)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool/list?course_id=${courseActive}`;
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool_night/list?course_id=${courseActive}`;
this.http.get(getConnectionString, options)
.map(response => response.json())
.subscribe(data => {
resolve(this.transformRegionSchoolsSchema(data));
},
error => {
console.log("Error HTTP GET Service in getRegionsWithSchools method");
reject("Error HTTP GET Service");
});
this.lockApprovSub = this.getStatusofLockSmallClasses().subscribe(data => {
this.lockApprov$.next(data);
this.lockApprov$.getValue().forEach(lockapp =>
{
this.lockapp = lockapp.res;
if (this.lockapp === 0){
if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/regions/list`;
else if (classActive === 2)
getConnectionString = `${AppSettings.API_ENDPOINT}/sectorsperschool/list?sector_id=${courseActive}`;
else if (classActive === 3)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool/list?course_id=${courseActive}`;
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool_night/list?course_id=${courseActive}`;
}
else
{
if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getregions`;
else if (classActive === 2)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/sectorsperschool/`+ courseActive;
else if (classActive === 3)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getcoursesperschoolsmallclasses/`+ courseActive;
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getcoursesperschoolsmallclasses_night/`+ courseActive;
}
this.http.get(getConnectionString, options)
.map(response => response.json())
.subscribe(data => {
resolve(this.transformRegionSchoolsSchema(data));
},
error => {
console.log("Error HTTP GET Service in getRegionsWithSchools method");
reject("Error HTTP GET Service");
});
})
},
error => {
this.lockApprov$.next([{}]);
console.log("Error getting Settings");
});
});
};
......@@ -282,6 +321,7 @@ export class HelperDataService implements OnInit, OnDestroy {
rsa[trackIndex].epals.push(<IRRegionSchool>{ "epal_id": regionSchool.epal_id, "epal_name": regionSchool.epal_name, "epal_special_case": regionSchool.epal_special_case, "globalIndex": j, "selected": false, "order_id": 0 });
j++;
});
return rsa;
}
......@@ -790,7 +830,7 @@ export class HelperDataService implements OnInit, OnDestroy {
.map(response => response.json());
}
storeAdminSettings(username, userpassword, capac, dirview, applogin, appmodify, appdelete, appresults, secondperiod, datestart) {
storeAdminSettings(username, userpassword, capac, dirview, applogin, appmodify, appdelete, appresults, secondperiod, datestart, smallClassApproved) {
let headers = new Headers({
"Content-Type": "application/json",
......@@ -801,7 +841,7 @@ export class HelperDataService implements OnInit, OnDestroy {
return this.http.get(`${AppSettings.API_ENDPOINT}/ministry/store-settings/` +
Number(capac) + "/" + Number(dirview) + "/" + Number(applogin) + "/" + Number(appmodify) + "/" +
Number(appdelete) + "/" + Number(appresults) + "/" + Number(secondperiod) + "/" + datestart, options)
Number(appdelete) + "/" + Number(appresults) + "/" + Number(secondperiod) + "/" + datestart + "/" + Number(smallClassApproved) , options)
.map(response => response.json());
}
......@@ -1280,7 +1320,7 @@ export class HelperDataService implements OnInit, OnDestroy {
reject("Error HTTP GET Service");
});
});
};
}
saveApprovedClasses(taxi, classid, type)
{
......@@ -1298,4 +1338,23 @@ saveApprovedClasses(taxi, classid, type)
}
getStatusofLockSmallClasses()
{
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 });
console.log("test");
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/locksmallclasses`, 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