Merge branch 'pde-dde-views' into 'develop'

contact form, desclaimer, footers

See merge request !182
parents ce5450a5 5eeee17c
......@@ -294,3 +294,11 @@ epal.findcoursesperschool:
_controller: '\Drupal\epal\Controller\DirectorView::FindCoursesPerSchool'
requirements:
_user_is_logged_in: 'TRUE'
epal.user.send_email:
path: '/epal/user/sendmail'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\HelpDesk::sendEmail'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
<?php
/**
* @file
* Contains \Drupal\query_example\Controller\QueryExampleController.
*/
namespace Drupal\epal\Controller;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Connection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\TypedData\Plugin\DataType\TimeStamp;
use Drupal\Core\Language\LanguageManagerInterface;
class HelpDesk extends ControllerBase {
protected $entityTypeManager;
protected $logger;
protected $connection;
public function __construct(
EntityTypeManagerInterface $entityTypeManager,
LoggerChannelFactoryInterface $loggerChannel,
Connection $connection
) {
$this->entityTypeManager = $entityTypeManager;
$this->logger = $loggerChannel->get('epal-school');
$this->connection = $connection;
}
public static function create(ContainerInterface $container)
{
return new static(
$container->get('entity_type.manager'),
$container->get('logger.factory'),
$container->get('database')
);
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
return $res;
}
public function sendEmail(Request $request)
{
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
], Response::HTTP_METHOD_NOT_ALLOWED);
}
$postData = null;
if ($content = $request->getContent()) {
$postData = json_decode($content);
$this->sendEmailwithcommets($postData->userEmail, $postData->userName, $postData->userMessage,$postData->userSurname);
return $this->respondWithStatus([
'userEmail' => $postData->userEmail,
'name' => $postData->userName,
'surname' => $postData->userSurname,
'message' => $postData->userMessage,
], Response::HTTP_OK);
}
else {
return $this->respondWithStatus([
'message' => t("post with no data"),
], Response::HTTP_BAD_REQUEST);
}
}
private function sendEmailwithcommets($email, $name, $cont_message, $surname) {
$mailManager = \Drupal::service('plugin.manager.mail');
$module = 'HelpDesk';
$key = 'send_mail';
$to = 'aspakatsi@yahoo.gr';
$params['message'] = 'Αποστολέας:'.$email.'Όνομα:'.$name.'Επωνυμο:'.$surname.'Μήνυμα:'.$cont_message;
$langcode = 'el';
$send = true;
$mail_sent = $mailManager->mail($module, $key, $to, $langcode, $params, NULL, $send);
if ($mail_sent) {
$this->logger->info("Mail Sent successfully.");
}
else {
$this->logger->info("There is error in sending mail.");
}
return;
}
}
......@@ -12,8 +12,8 @@
//position: absolute;
//bottom: 0;
width: 100%;
height: 41px;
line-height: 41px;
height: 100px;
line-height: 20px;
background-color: #3a3a3a;
color: #909090;
.ft-text {
......
......@@ -2,8 +2,20 @@
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="row">
<div class="col-xs-12 col-md-8"><span class="ft-text align-middle">Η εφαρμογή σχεδιάστηκε και υλοποιήθηκε από την Ομάδα Ανοιχτού Λογισμικού του ΥΠΠΕΘ
<br></span>
<span class="ft-text align-middle"> Όροι Χρήσης και Δήλωση Απορρήτου | Άδεια χρήσης περιεχομένου: CC-BY-SA </span>
</div>
</div>
<br>
<div class="row">
<div class="col-xs-12 col-md-4"><span class="ft-text">Copyright (c) ΥΠ.Π.Ε.Θ. 2017</span></div>
<div class="cols-xs-12 col-md-6 text-center">
<!-- <span class="ft-text"><a href="#">ΟΡΟΙ ΧΡΗΣΗΣ – ΕΜΠΙΣΤΕΥΤΙΚΟΤΗΤΑ</a></span>
<span class="ft-text"><a href="#">ΠΡΟΣΩΠΙΚΑ ΔΕΔΟΜΕΝΑ</a></span> -->
......
......@@ -28,8 +28,14 @@
<i class="fa fa-home isclickable" (click)="goHome()"></i>
<span class="signout isclickable" (click)="goHome()" style="color:#CC3300;">&nbsp;&nbsp;Αρχική</span>
</div>
<div class="col-md-2">
<span class="signout isclickable" (click)="gohelpDesk()" style="color:#CC3300;">&nbsp;&nbsp;Help Desk</span>
</div>
<div class="col-md-6">&nbsp;</div>
<div class="col-md-4">&nbsp;</div>
<div class="col-md-4" style="text-align: right">
<span class="username" style="text-align: right">{{ cuName }}&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="signout isclickable" style="text-align: right" (click)="signOut()" style="color:#CC3300;">Αποσύνδεση&nbsp;&nbsp;</span>
......
......@@ -139,6 +139,11 @@ export default class HeaderComponent implements OnInit, OnDestroy {
}
}
gohelpDesk()
{
this.router.navigate(['/help-desk']);
}
public showModal(): void {
(<any>$("#headerNotice")).modal("show");
}
......
......@@ -17,34 +17,39 @@ import {
Validators,
} from '@angular/forms';
@Component({
selector: 'perfecture-view',
selector: 'eduadmin-view',
template: `
<h3> Αριθμός Μαθητών ανα τμήμα σχολείου </h3>
<ul class="list-group main-view">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<h5> {{SchoolNames$.name}}</h5>
</li>
<div *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even" [class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)" [hidden]="SchoolNames$.id !== regionActive" >
<div> {{CoursesNames$.name}}</div> <div class= "aastyle"><strong>Αριθμός Μαθητών:</strong>{{CoursesNames$.size}} </div>
</div>
</div>
</ul>
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" >
<i class="fa fa-forward"></i>
</button>
<div class = "loading" *ngIf="(showLoader | async) === true"></div>
<div style="min-height: 500px;">
<form [formGroup]="formGroup">
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
</p>
<div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Τα τμήματα. </b>
</div>
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)"
[class.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div class="col-md-12" style="font-size: 0.8em; font-weight: bold;" >{{SchoolNames$.name}}</div>
</li>
<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.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.name}}</div>
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.size}}</div>
</div>
</div>
</form>
</div>
`
})
@Injectable() export default class PerfectureView implements OnInit, OnDestroy {
@Injectable() export default class EduadminView implements OnInit, OnDestroy {
public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>;
......@@ -55,6 +60,7 @@ import {
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
private showLoader: BehaviorSubject<boolean>;
public perfecture;
private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
......@@ -71,6 +77,7 @@ import {
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.School$ = new BehaviorSubject([{}]);
this.showLoader = new BehaviorSubject(false);
this.formGroup = this.fb.group({
});
......@@ -81,8 +88,11 @@ import {
ngOnInit() {
this.showLoader.next(true);
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.SchoolsPerPerf$.next([{}]);
......@@ -91,36 +101,42 @@ import {
}
setActiveRegion(ind) {
if (ind === this.regionActive)
ind = -1;
this.regionActive = ind;
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
});
calccolor(size, limit) {
if (size < limit)
return true;
else
return false;
}
navigateToApplication() {
var id: string = String(this.regionActive);
this.router.navigate(['', { ids: id }]);
}
setActiveRegion(ind) {
if (ind === this.regionActive) {
ind = -1;
this.regionActive = ind;
}
else {
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
this.showLoader.next(false);
});
}
this.regionActive = ind;
calccolor(size, limit) {
if (size < limit)
return true;
else
return false;
}
}
......@@ -54,16 +54,21 @@ import {
<form novalidate [formGroup]="formGroup" #form>
<p align="left"><strong> Διάφορα Έγγραφα </strong></p>
<p align="left"><strong> Νομοθεσία </strong></p>
<li class="list-group-item isclickable evenout" >
<a class="col-md-12" style="font-size: 0.8em; font-weight: bold;" href="../pdfs/files/ypourgikh.pdf" target="_blank">Υπουργική Απόφαση - </a>
</li>
<li class="list-group-item isclickable oddout" >
<a class="col-md-12" style="font-size: 0.8em; font-weight: bold;" href="../pdfs/files/egkyklios.pdf" target="_blank">Η με αρ.πρωτ. 89047/ΓΔ4/26-05-2017 Εγκύκλιος του Υ.Π.Π.Ε.Θ.</a>
<a class="col-md-12" style="font-size: 0.8em; font-weight: bold;" href="../pdfs/files/egkyklios.pdf" target="_blank">Εγκύκλιος του Υ.Π.Π.Ε.Θ.- αρ.πρωτ. 89047/ΓΔ4/26-05-2017 </a>
</li>
<br>
<br>
<p align="left"><strong> Χρήσιμες Πληροφορίες </strong></p>
<li class="list-group-item isclickable evenout" >
<a class="col-md-12" style="font-size: 0.8em; font-weight: bold;" href="../pdfs/files/infos.pdf" target="_blank">Ενημερωτικά Στοιχεία</a>
</li>
<br>
<br>
<div class="row">
......
import { Component, OnInit, OnDestroy } from "@angular/core";
import { Injectable } from "@angular/core";
import { VALID_EMAIL_PATTERN, VALID_NAMES_PATTERN } from '../../constants';
import {Router} from "@angular/router";
import { BehaviorSubject, Subscription, Observable } from 'rxjs/Rx';
import { HelperDataService } from '../../services/helper-data-service';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray,
Validators,
} from '@angular/forms';
@Component({
selector: 'helpdesk',
template: `
<p align="left"><strong>Ηλεκτρονικές δηλώσεις προτίμησης ΕΠΑΛ για το νέο σχολικό έτος</strong></p>
<p align="left">
Σε περίπτωση που αντιμετωπίζετε οποιοδήποτε πρόβλημα με την καταχώριση της αίτησής σας, παρακαλούμε να
συμπληρώσετε την παρακάτω φόρμα.
<p align="left"><strong> Φόρμα Επικοινωνίας </strong></p>
<form [formGroup]="formGroup">
<div class="form-group">
<label for="userEmail">Email Επικοινωνίας(<span style="color: #ff0000;">*</span>)</label>
<input #userEmail class="form-control" type="text" formControlName="userEmail">
</div>
<div class="alert alert-danger" *ngIf="formGroup.get('userEmail').touched && formGroup.get('userEmail').hasError('required') ">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="formGroup.get('userEmail').hasError('pattern')">
Πληκτρολογήστε ένα σωστό συντακτικά email!
</div>
<div class="form-group">
<label for="userName">Όνομα(<span style="color: #ff0000;">*</span>)</label>
<input class="form-control" type="text" formControlName="userName">
<div class="alert alert-danger" *ngIf="formGroup.get('userName').touched && formGroup.get('userName').hasError('required') ">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="formGroup.get('userName').hasError('pattern')">
Πληκτρολογήστε το όνομά σας!
</div>
</div>
<div class="form-group">
<label for="userSurname">Επώνυμο(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="userSurname">
<div class="alert alert-danger" *ngIf="formGroup.get('userSurname').touched && formGroup.get('userSurname').hasError('required') ">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="formGroup.get('userSurname').hasError('pattern')">
Πληκτρολογήστε το επώνυμό σας!
</div>
</div>
<div class="form-group">
<label for="userMessage">Μύνημα(<span style="color: #ff0000;">*</span>)</label>
<textarea style="height: 150px;" class="form-control" type="text" formControlName="userMessage"></textarea>
<div class="alert alert-danger" *ngIf="formGroup.get('userMessage').touched && formGroup.get('userMessage').hasError('required') ">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="formGroup.get('userMessage').hasError('pattern')">
Πληκτρολογήστε ενα μήνυμα!
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="button" class="btn-primary btn-lg isclickable" style="width: 9em;" (click)="sendmail()" >
<span style="font-size: 0.9em; font-weight: bold;">Αποστολή email &nbsp;&nbsp;&nbsp;</span>
</button>
</div>
</div>
<br>
<br>
Τηλ. Επικοινωνίας: 2103443014, 2103442231, 2103443359, 2103442034, 2103443309 (ώρες: 8:00 - 16:00)
`
})
@Injectable() export default class HelpDesk implements OnInit, OnDestroy {
public formGroup: FormGroup;
private emailSent: BehaviorSubject<boolean>;
constructor(private fb: FormBuilder,
private hds: HelperDataService,)
{
this.formGroup = fb.group({
userEmail: ['', [Validators.pattern(VALID_EMAIL_PATTERN),Validators.required]],
userName: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
userSurname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
userMessage: ['', [Validators.required]],
})
this.emailSent = new BehaviorSubject(false);
}
ngOnDestroy() {
}
ngOnInit() {
}
sendmail() {
this.hds.sendmail(this.formGroup.value.userEmail, this.formGroup.value.userName, this.formGroup.value.userSurname,this.formGroup.value.userMessage)
.then(res => {
this.emailSent.next(true);
})
.catch(err => {
console.log(err);
});
}
}
......@@ -43,7 +43,7 @@ import StudentAuthGuard from '../guards/student.auth.guard';
import StudentLockGuard from '../guards/student.lock.guard';
import RegionEduAuthGuard from '../guards/regionedu.auth.guard';
import EduAdminAuthGuard from '../guards/eduadmin.auth.guard';
import HelpDesk from '../components/student-application-form/help-desk';
import MinistryAuthGuard from '../guards/ministry.auth.guard';
import ReportsAuthGuard from '../guards/reports.auth.guard';
import Breadcrumbs from '../components/main/breadcrumbs';
......@@ -84,6 +84,7 @@ export const MainRoutes: Routes = [
{ path: 'ministry/minister-settings', component: MinisterSettings, canActivate: [MinistryAuthGuard] },
{ path: 'school/perfecture-view', component: PerfectureView, canActivate: [RegionEduAuthGuard] },
{ path: 'school/eduadmin-view', component: EduadminView, canActivate: [EduAdminAuthGuard] },
{ path: 'help-desk', component: HelpDesk },
];
export const MainDeclarations = [
......@@ -121,4 +122,5 @@ export const MainDeclarations = [
Breadcrumbs,
DirectorButtons,
EduadminView,
HelpDesk,
];
......@@ -978,4 +978,27 @@ export class HelperDataService implements OnInit, OnDestroy {
err => console.error(err));
}
sendmail(email, name, surname, message) {
let headers = new Headers({
"Content-Type": "application/json",
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/user/sendmail`, { userEmail: email, userName : name, userSurname : surname, userMessage : message }, options)
.map(response => response.json())
.subscribe(data => {
resolve(data);
},
error => {
console.log("Error Sending Email");
reject("Error Sending email");
});
});
}
}
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