Commit 18aec6b5 authored by Open Source Developer's avatar Open Source Developer

rewrite controllers

parent cf136167
...@@ -103,7 +103,7 @@ epal.confirmstudents: ...@@ -103,7 +103,7 @@ epal.confirmstudents:
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
epal.studentperschool: epal.studentperschool:
path: '/epal/studentperschool/{selectId}/{classId}/{limitdown}/{limitup}' path: '/epal/studentperschool/{classId}/{sector}/{specialit}'
options: options:
_auth: [ 'basic_auth' ] _auth: [ 'basic_auth' ]
defaults: defaults:
......
...@@ -159,77 +159,84 @@ class DirectorView extends ControllerBase ...@@ -159,77 +159,84 @@ class DirectorView extends ControllerBase
} }
} }
public function getStudentPerSchool(Request $request, $selectId, $classId, $limitdown, $limitup) public function getStudentPerSchool(Request $request, $classId, $sector, $specialit)
{ {
try { try {
$authToken = $request->headers->get('PHP_AUTH_USER'); $authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$epalId = $user->init->value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $epalId));
$school = reset($schools);
if (!$school) {
$this->logger->warning('no access to this school='.$user->id());
return $this->respondWithStatus([
"message" => "No access to this school"
], Response::HTTP_FORBIDDEN);
}
$userRoles = $user->getRoles(); $users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$userRole = ''; $user = reset($users);
foreach ($userRoles as $tmpRole) { if ($user)
if ($tmpRole === 'epal') { {
$userRole = $tmpRole; $epalId = $user->init->value;
} $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $epalId));
$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;
}
$userRoles = $user->getRoles();
$userRole = '';
foreach ($userRoles as $tmpRole)
{
if ($tmpRole === 'epal')
{
$userRole = $tmpRole;
} }
if ($userRole === '') { }
return $this->respondWithStatus([ if ($userRole === '')
'error_code' => 4003, {
], Response::HTTP_FORBIDDEN); return $this->respondWithStatus([
} elseif ($userRole === 'epal') { 'error_code' => 4003,
if ($classId == 1) { ], Response::HTTP_FORBIDDEN);
$selectId = -1; }
} elseif ($userRole === 'epal')
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id' => $epalId, 'specialization_id' => $selectId, 'currentclass' => $classId)); {
$selectIdNew = $selectId;
if ($studentPerSchool) { if ($classId == 1)
$list = array(); $selectIdNew = -1;
if ($limitdown == $limitup && $limitup == 0) { elseif ($classId == 2)
$list = array( $selectIdNew = $sector;
'id' => sizeof($studentPerSchool), else
'up' => $limitup, $selectIdNew = $specialit;
'down' => $limitdown, $studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal' => $epalId, 'specialization_id' => $selectIdNew, 'currentclass' => $classId));
); }
} else { $i = 0;
$i = 0; if ($studentPerSchool)
foreach ($studentPerSchool as $object) { {
$studentId = $object->id(); $list = array();
$epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id' => $studentId)); foreach ($studentPerSchool as $object)
$epalStudent = reset($epalStudents); {
$studentId = $object->id();
if ($epalStudent) { $epalStudents = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id' => $studentId));
$epalStudent = reset($epalStudents);
if ($epalStudents)
{
$studentIdNew = $epalStudent->id(); $studentIdNew = $epalStudent->id();
$checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('student_id' => $studentIdNew)); $checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('student_id' => $studentIdNew));
$checkstudentstatus = reset($checkstatus); $checkstudentstatus = reset($checkstatus);
if ($i >= $limitdown && $i < $limitup) { $sectorName = '';
$sectorName = ''; $courseName = '';
$courseName = ''; if ($epalStudent->currentclass->value === '2') {
if ($epalStudent->currentclass->value === '2') { $sectors = $this->entityTypeManager->getStorage('epal_student_sector_field')->loadByProperties(array('student_id' => $studentIdNew));
$sectors = $this->entityTypeManager->getStorage('epal_student_sector_field')->loadByProperties(array('student_id' => $studentIdNew)); $sector = reset($sectors);
$sector = reset($sectors); if ($sector)
if ($sector) { $sectorName = $this->entityTypeManager->getStorage('eepal_sectors')->load($sector->sectorfield_id->target_id)->name->value;
$sectorName = $this->entityTypeManager->getStorage('eepal_sectors')->load($sector->sectorfield_id->target_id)->name->value; }
} else if ($epalStudent->currentclass->value === '3' || $epalStudent->currentclass->value === '4') {
} elseif ($epalStudent->currentclass->value === '3' || $epalStudent->currentclass->value === '4') { $courses = $this->entityTypeManager->getStorage('epal_student_course_field')->loadByProperties(array('student_id' => $studentIdNew));
$courses = $this->entityTypeManager->getStorage('epal_student_course_field')->loadByProperties(array('student_id' => $studentIdNew)); $course = reset($courses);
$course = reset($courses); if ($course)
if ($course) { $courseName = $this->entityTypeManager->getStorage('eepal_specialty')->load($course->coursefield_id->target_id)->name->value;
$courseName = $this->entityTypeManager->getStorage('eepal_specialty')->load($course->coursefield_id->target_id)->name->value; }
}
}
$newstatus = $checkstudentstatus->directorconfirm->value;
$crypt = new Crypt(); $crypt = new Crypt();
try { try {
...@@ -247,20 +254,7 @@ class DirectorView extends ControllerBase ...@@ -247,20 +254,7 @@ class DirectorView extends ControllerBase
$guardian_surname_decoded = $crypt->decrypt($epalStudent->guardian_surname->value); $guardian_surname_decoded = $crypt->decrypt($epalStudent->guardian_surname->value);
$guardian_fathername_decoded = $crypt->decrypt($epalStudent->guardian_fathername->value); $guardian_fathername_decoded = $crypt->decrypt($epalStudent->guardian_fathername->value);
$guardian_mothername_decoded = $crypt->decrypt($epalStudent->guardian_mothername->value); $guardian_mothername_decoded = $crypt->decrypt($epalStudent->guardian_mothername->value);
// $name_decoded = $epalStudent->name->value;
// $studentsurname_decoded = $epalStudent->studentsurname->value;
// $fatherfirstname_decoded = $epalStudent->fatherfirstname->value;
// $motherfirstname_decoded = $epalStudent->motherfirstname->value;
// $regionaddress_decoded = $epalStudent->regionaddress->value;
// $regiontk_decoded = $epalStudent->regiontk->value;
// $regionarea_decoded = $epalStudent->regionarea->value;
// $certificatetype_decoded = $epalStudent->certificatetype->value;
// $relationtostudent_decoded = $epalStudent->relationtostudent->value;
// $telnum_decoded = $epalStudent->telnum->value;
// $guardian_name_decoded = $epalStudent->guardian_name->value;
// $guardian_surname_decoded = $epalStudent->guardian_surname->value;
// $guardian_fathername_decoded = $epalStudent->guardian_fathername->value;
// $guardian_mothername_decoded = $epalStudent->guardian_mothername->value;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->warning(__METHOD__ . ' Decrypt error: ' . $e->getMessage()); $this->logger->warning(__METHOD__ . ' Decrypt error: ' . $e->getMessage());
return $this->respondWithStatus([ return $this->respondWithStatus([
...@@ -268,82 +262,62 @@ class DirectorView extends ControllerBase ...@@ -268,82 +262,62 @@ class DirectorView extends ControllerBase
], Response::HTTP_INTERNAL_SERVER_ERROR); ], Response::HTTP_INTERNAL_SERVER_ERROR);
} }
$list[] = array(
'i' => $i,
'id' => $epalStudent->id(),
'name' => $name_decoded,
'studentsurname' => $studentsurname_decoded,
'fatherfirstname' => $fatherfirstname_decoded,
'fathersurname' => $epalStudent->fathersurname->value,
'motherfirstname' => $motherfirstname_decoded,
'mothersurname' => $epalStudent->mothersurname->value,
'guardian_name' => $guardian_name_decoded,
'guardian_surname' => $guardian_surname_decoded,
'guardian_fathername' => $guardian_fathername_decoded,
'guardian_mothername' => $guardian_mothername_decoded,
'lastschool_schoolname' => $epalStudent->lastschool_schoolname->value,
'lastschool_schoolyear' => $epalStudent->lastschool_schoolyear->value,
'lastschool_class' => $epalStudent->currentclass->value,
'currentclass' => $epalStudent->currentclass->value,
'currentsector' => $sectorName,
'currentcourse' => $courseName,
'regionaddress' => $regionaddress_decoded,
'regiontk' => $regiontk_decoded,
'regionarea' => $regionarea_decoded,
'certificatetype' => $certificatetype_decoded,
'graduation_year' => $epalStudent->graduation_year->value,
'telnum' => $telnum_decoded,
'relationtostudent' => $relationtostudent_decoded,
//'birthdate' => substr($epalStudent->birthdate->value, 8, 10) . '/' . substr($epalStudent->birthdate->value, 6, 8) . '/' . substr($epalStudent->birthdate->value, 0, 4),
'birthdate' => date("d-m-Y", strtotime($epalStudent->birthdate->value)),
'checkstatus' => $newstatus[0][value],
'created' => date('d/m/Y H:i', $epalStudent->created->value)
);
}
++$i;
}
}
}
return $this->respondWithStatus( $list[] = array(
$list, Response::HTTP_OK); 'id' => $epalStudent->id(),
} else { 'name' => $name_decoded,
if ($limitdown == $limitup && $limitup == 0) { 'studentsurname' => $studentsurname_decoded,
$list = [ 'fatherfirstname' => $fatherfirstname_decoded,
'id' => sizeof($studentPerSchool), 'motherfirstname' => $motherfirstname_decoded,
'up' => $limitup, 'guardian_name' => $guardian_name_decoded,
'down' => $limitdown, 'guardian_surname' => $guardian_surname_decoded,
]; 'guardian_fathername' => $guardian_fathername_decoded,
} else { 'guardian_mothername' => $guardian_mothername_decoded,
$list = []; 'lastschool_schoolname' => $epalStudent->lastschool_schoolname->value,
} 'lastschool_schoolyear' => $epalStudent->lastschool_schoolyear->value,
'lastschool_class' => $epalStudent->lastschool_class->value,
return $this->respondWithStatus($list, Response::HTTP_OK); 'currentclass' =>$epalStudent -> currentclass ->value,
} 'currentsector' =>$sectorName,
} else { 'currentcourse' =>$courseName,
if ($limitdown == $limitup && $limitup == 0) { 'regionaddress' => $regionaddress_decoded,
$list = [ 'regiontk' => $regiontk_decoded,
'id' => sizeof($studentPerSchool), 'regionarea' => $regionarea_decoded,
'up' => $limitup, 'certificatetype' => $certificatetype_decoded,
'down' => $limitdown, 'graduation_year' => $epalStudent->graduation_year->value,
]; 'telnum' => $telnum_decoded,
} else { 'relationtostudent' => $relationtostudent_decoded,
$list = []; //'birthdate' => substr($epalStudent->birthdate->value, 8, 10) . '/' . substr($epalStudent->birthdate->value, 6, 8) . '/' . substr($epalStudent->birthdate->value, 0, 4),
} 'birthdate' => date("d-m-Y", strtotime($epalStudent->birthdate->value)),
'checkstatus' => $checkstudentstatus -> directorconfirm ->value,
return $this->respondWithStatus($list, Response::HTTP_OK); 'created' => date('d/m/Y H:i', $epalStudent -> created ->value),
);
}
++$i;
} }
} else { return $this->respondWithStatus(
return $this->respondWithStatus([ $list, Response::HTTP_OK);
'message' => t('User not found!'), }
else
{
return $this->respondWithStatus([
'message' => t('Students not found!'),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
} catch (\Exception $e) { }
$this->logger->warning($e->getMessage()); else
{
return $this->respondWithStatus([ return $this->respondWithStatus([
'message' => t('User not found!'),
], Response::HTTP_FORBIDDEN);
}
}
catch (\Exception $e)
{
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
'message' => t('Unexpected Error'), 'message' => t('Unexpected Error'),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
} }
public function ConfirmStudents(Request $request) public function ConfirmStudents(Request $request)
...@@ -376,28 +350,53 @@ class DirectorView extends ControllerBase ...@@ -376,28 +350,53 @@ class DirectorView extends ControllerBase
$postData = json_decode($content); $postData = json_decode($content);
$arr = $postData->students; $arr = $postData->students;
$type = $postData->type; $type = $postData->type;
$valnew = intval($arr);
foreach ($arr as $value) { $typen = intval($type);
$valnew = intval($value);
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew)); $studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew));
$studentConfirm = reset($studentForConfirm); $studentConfirm = reset($studentForConfirm);
if ($studentConfirm) { if ($studentConfirm) {
if ($type == 1) { if ($typen === 1) {
$studentConfirm->set('directorconfirm', true); $studentConfirm->set('directorconfirm', 1);
$studentConfirm->save();
return $this->respondWithStatus([
'message' => t('saved')
,
], Response::HTTP_OK);
} }
if ($type == 2) { elseif ($typen === 2) {
$studentConfirm->set('directorconfirm', false); $studentConfirm->set('directorconfirm', 0);
$studentConfirm->save();
return $this->respondWithStatus([
'message' => t('saved')
,
], Response::HTTP_OK);
} }
if ($type == 3) { elseif ($typen === 3) {
unset($studentConfirm->{directorconfirm}); unset($studentConfirm->{directorconfirm});
$studentConfirm->save();
return $this->respondWithStatus([
'message' => t('saved')
,
], Response::HTTP_OK);
}
else
{
return $this->respondWithStatus([
'message' => t('Bad request'),
], Response::HTTP_FORBIDDEN);
} }
$studentConfirm->save();
} }
} else
{
return $this->respondWithStatus([
'message' => t('Student not found'),
], Response::HTTP_FORBIDDEN);
}
return $this->respondWithStatus([
'message' => t('saved'),
], Response::HTTP_OK);
} }
} else { } else {
return $this->respondWithStatus([ return $this->respondWithStatus([
...@@ -1027,6 +1026,7 @@ class DirectorView extends ControllerBase ...@@ -1027,6 +1026,7 @@ class DirectorView extends ControllerBase
return $response; return $response;
} }
$operation_shift = $school -> operation_shift -> value;
$userRoles = $user->getRoles(); $userRoles = $user->getRoles();
$userRole = ''; $userRole = '';
foreach ($userRoles as $tmpRole) { foreach ($userRoles as $tmpRole) {
...@@ -1039,11 +1039,19 @@ class DirectorView extends ControllerBase ...@@ -1039,11 +1039,19 @@ class DirectorView extends ControllerBase
'error_code' => 4003, 'error_code' => 4003,
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} elseif ($userRole === 'epal') { } elseif ($userRole === 'epal') {
$categ = $school->metathesis_region->value;
$list = array(); $list = array();
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid)); $CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid));
$classcapacity = reset($CapacityPerClass); $classcapacity = reset($CapacityPerClass);
if ($classcapacity) { if ($classcapacity) {
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name' => 1, 'category' => $categ));
$limitdown = reset($limit_down);
if ($limitdown) {
$limit = $limitdown->limit_down->value;
}
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal' => $schoolid, 'specialization_id' => -1, 'currentclass' => 1));
$list[] = array( $list[] = array(
'class' => 1, 'class' => 1,
'newsector' => 0, 'newsector' => 0,
...@@ -1051,13 +1059,22 @@ class DirectorView extends ControllerBase ...@@ -1051,13 +1059,22 @@ class DirectorView extends ControllerBase
'taxi' => 'Ά Λυκείου', 'taxi' => 'Ά Λυκείου',
'capacity' => $classcapacity->capacity_class_a->value, 'capacity' => $classcapacity->capacity_class_a->value,
'globalindex' => $i, 'globalindex' => $i,
'limitdown' => $limit,
'size' => sizeof($studentPerSchool),
); );
} }
++$i; ++$i;
$CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid)); $CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid));
if ($CourseB) { if ($CourseB) {
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name' => 2, 'category' => $categ));
$limitdown = reset($limit_down);
if ($limitdown) {
$limit = $limitdown->limit_down->value;
}
foreach ($CourseB as $object) { foreach ($CourseB as $object) {
$sectorid = $object->sector_id->entity->id(); $sectorid = $object->sector_id->entity->id();
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal' => $schoolid, 'specialization_id' => $sectorid, 'currentclass' => 2));
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $sectorid)); $CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $sectorid));
$classcapacity = reset($CapacityPerClass); $classcapacity = reset($CapacityPerClass);
if ($classcapacity) { if ($classcapacity) {
...@@ -1068,6 +1085,8 @@ class DirectorView extends ControllerBase ...@@ -1068,6 +1085,8 @@ class DirectorView extends ControllerBase
'taxi' => 'Β Λυκείου '.$object->sector_id->entity->get('name')->value, 'taxi' => 'Β Λυκείου '.$object->sector_id->entity->get('name')->value,
'capacity' => $classcapacity->capacity_class_sector->value, 'capacity' => $classcapacity->capacity_class_sector->value,
'globalindex' => $i, 'globalindex' => $i,
'limitdown' => $limit,
'size' => sizeof($studentPerSchool),
); );
} }
++$i; ++$i;
...@@ -1075,8 +1094,15 @@ class DirectorView extends ControllerBase ...@@ -1075,8 +1094,15 @@ class DirectorView extends ControllerBase
} }
$CourseC = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid)); $CourseC = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid));
if ($CourseC) { if ($CourseC) {
foreach ($CourseC as $object) { $limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name' => 3, 'category' => $categ));
$limitdown = reset($limit_down);
if ($limitdown) {
$limit = $limitdown->limit_down->value;
}
foreach ($CourseC as $object) {
$specialityid = $object->specialty_id->entity->id(); $specialityid = $object->specialty_id->entity->id();
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal' => $schoolid, 'specialization_id' => $specialityid, 'currentclass' => 3));
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialityid)); $CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialityid));
$classcapacity = reset($CapacityPerClass); $classcapacity = reset($CapacityPerClass);
if ($classcapacity) { if ($classcapacity) {
...@@ -1087,15 +1113,24 @@ class DirectorView extends ControllerBase ...@@ -1087,15 +1113,24 @@ class DirectorView extends ControllerBase
'taxi' => 'Γ Λυκείου '.$object->specialty_id->entity->get('name')->value, 'taxi' => 'Γ Λυκείου '.$object->specialty_id->entity->get('name')->value,
'capacity' => $classcapacity->capacity_class_specialty->value, 'capacity' => $classcapacity->capacity_class_specialty->value,
'globalindex' => $i, 'globalindex' => $i,
'limitdown' => $limit,
'size' => sizeof($studentPerSchool),
); );
} }
++$i; ++$i;
} }
} }
if ($CourseC) { if ($CourseC && $operation_shift != 'ΗΜΕΡΗΣΙΟ') {
$limit_down = $this->entityTypeManager->getStorage('epal_class_limits')->loadByProperties(array('name' => 4, 'category' => $categ));
$limitdown = reset($limit_down);
if ($limitdown) {
$limit = $limitdown->limit_down->value;
}
foreach ($CourseC as $object) { foreach ($CourseC as $object) {
$specialityid = $object->specialty_id->entity->id(); $specialityid = $object->specialty_id->entity->id();
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal' => $schoolid, 'specialization_id' => $specialityid, 'currentclass' => 4));
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialityid)); $CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialityid));
$classcapacity = reset($CapacityPerClass); $classcapacity = reset($CapacityPerClass);
if ($classcapacity) { if ($classcapacity) {
...@@ -1106,6 +1141,8 @@ class DirectorView extends ControllerBase ...@@ -1106,6 +1141,8 @@ class DirectorView extends ControllerBase
'taxi' => 'Δ Λυκείου '.$object->specialty_id->entity->get('name')->value, 'taxi' => 'Δ Λυκείου '.$object->specialty_id->entity->get('name')->value,
'capacity' => $classcapacity->capacity_class_specialty_d->value, 'capacity' => $classcapacity->capacity_class_specialty_d->value,
'globalindex' => $i, 'globalindex' => $i,
'limitdown' => $limit,
'size' => sizeof($studentPerSchool),
); );
} }
......
...@@ -33,7 +33,7 @@ import { ...@@ -33,7 +33,7 @@ import {
επιλέξτε τη νέα δυναμική και πατήστε το σύμβολο <i>ok</i>. Προσοχή! Κανένα τμήμα δεν πρέπει να έχει δυναμική 0.</p> επιλέξτε τη νέα δυναμική και πατήστε το σύμβολο <i>ok</i>. Προσοχή! Κανένα τμήμα δεν πρέπει να έχει δυναμική 0.</p>
<div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Οι δηλώσεις σας </b></div> <div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Οι δηλώσεις σας </b></div>
<div *ngFor="let CapacityPerCourses$ of CapacityPerCourse$ | async; let i=index; let isOdd=odd; let isEven=even" > <div *ngFor="let CapacityPerCourses$ of CapacityPerCourse$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li *ngIf="(!(selectiontype | async) && (CapacityPerCourses$.class < 4)) ||((selectiontype | async) && (CapacityPerCourses$.class < 5))" class="list-group-item " [class.oddout]="isOdd" [class.evenout]="isEven" > <li class="list-group-item " [class.oddout]="isOdd" [class.evenout]="isEven" >
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
<h5 [class.changelistcolor]= "CapacityPerCourses$.capacity === null" >{{CapacityPerCourses$.taxi}}&nbsp; <b></b></h5> <h5 [class.changelistcolor]= "CapacityPerCourses$.capacity === null" >{{CapacityPerCourses$.taxi}}&nbsp; <b></b></h5>
...@@ -212,7 +212,7 @@ import { ...@@ -212,7 +212,7 @@ import {
error => { error => {
std[ind].capacity = oldvalue; std[ind].capacity = oldvalue;
this.CapacityPerCourse$.next(std); this.CapacityPerCourse$.next(std);
this.showLoader.next(false);
console.log("Error Saving Capacity"); console.log("Error Saving Capacity");
}, },
() =>{ () =>{
......
import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Renderer } from "@angular/core"; import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings'; import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service