constants.ts 3.21 KB
Newer Older
Open Source Developer's avatar
Open Source Developer committed
1

2
3
import {ValidatorFn} from "@angular/forms";
import {AbstractControl} from "@angular/forms";
Open Source Developer's avatar
Open Source Developer committed
4

5
6
export const COURSEFIELDS_RECEIVED = "COURSEFIELDS_RECEIVED";
export const COURSEFIELDS_SELECTED_SAVE = "COURSEFIELDS_SELECTED_SAVE";
7

8
9
10
export const SECTORFIELDS_RECEIVED = "SECTORFIELDS_RECEIVED";
export const SECTORFIELDS_SELECTED_SAVE = "SECTORFIELDS_SELECTED_SAVE";
export const SECTORFIELDS_INIT = "SECTORFIELDS_INIT";
11

12
13
14
15
export const REGIONSCHOOLS_RECEIVED = "REGIONSCHOOLS_RECEIVED";
export const REGIONSCHOOLS_SELECTED_SAVE = "REGIONSCHOOLS_SELECTED_SAVE";
export const REGIONSCHOOLS_ORDER_SAVE = "REGIONSCHOOLS_ORDER_SAVE";
export const REGIONSCHOOLS_INIT = "REGIONSCHOOLS_INIT";
16

17
18
export const SECTORCOURSES_RECEIVED = "SECTORCOURSES_RECEIVED";
export const SECTORCOURSES_SELECTED_SAVE = "SECTORCOURSES_SELECTED_SAVE";
19
export const SECTORCOURSES_SECTOR_SELECTED_SAVE = "SECTORCOURSES_SECTOR_SELECTED_SAVE";
20
export const SECTORCOURSES_INIT = "SECTORCOURSES_INIT";
21

22
23
export const STUDENTDATAFIELDS_SAVE = "STUDENTDATAFIELDS_SAVE";
export const STUDENTDATAFIELDS_INIT = "STUDENTDATAFIELDS_INIT";
24

25
26
export const EPALCLASSES_SAVE = "EPALCLASSES_SAVE";
export const EPALCLASSES_INIT = "EPALCLASSES_INIT";
Open Source Developer's avatar
a    
Open Source Developer committed
27

28
29
30
export const LOGININFO_SAVE = "LOGININFO_SAVE";
export const PROFILE_SAVE = "PROFILE_SAVE";
export const STATEMENTAGREE_SAVE = "STATEMENTAGREE_SAVE";
Open Source Developer's avatar
Open Source Developer committed
31

32
export const LOGININFO_RECEIVED = "LOGININFO_RECEIVED";
Open Source Developer's avatar
Open Source Developer committed
33

34
35
export const USERINFOS_RECEIVED = "USERINFOS_RECEIVED";
export const USERINFO_SELECTED_SAVE = "USERINFO_SELECTED_SAVE";
36

37
export const LOGININFO_INIT = "LOGININFO_INIT";
38

39
40
41
export const CRITERIA_RECEIVED = "CRITERIA_RECEIVED";
export const CRITERIA_SAVE = "CRITERIA_SAVE";
export const CRITERIA_INIT = "CRITERIA_INIT";
42

43
44
45
46
47
48
49
50
export const VALID_NAMES_PATTERN = "^[A-Za-zΑ-ΩΆΈΉΊΙΎΌΏα-ωάέήίΐύόώ -]*$";
export const VALID_UCASE_NAMES_PATTERN = "^[A-ZΑ-Ω -]*$";
export const VALID_ADDRESS_PATTERN = "^[0-9A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ\/. -]*$";
export const VALID_ADDRESSTK_PATTERN = "^[0-9]{1,5}$";
export const VALID_DIGITS_PATTERN = "^[0-9]*$";
export const VALID_TELEPHONE_PATTERN = "^2[0-9]{0,10}$";
export const VALID_YEAR_PATTERN = "^(19[6789][0-9]|20[0-1][0-9])$";
export const VALID_CAPACITY_PATTERN = "[0-9]*$";
51

52
export const VALID_EMAIL_PATTERN = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}";
53

54
export const VALID_DATE_PATTERN = "([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]([1-9]|0[1-9]|1[012])[- /.](19|20)[0-9][0-9]";
55

56
57
58
59
60
export const SCHOOL_ROLE = "director";
export const STUDENT_ROLE = "student";
export const PDE_ROLE = "pde";
export const DIDE_ROLE = "dide";
export const MINISTRY_ROLE = "supervisor";
61
export const FIRST_SCHOOL_YEAR = 1950;
Open Source Developer's avatar
Open Source Developer committed
62
63

export function maxValue(max: Number): ValidatorFn {
64
65
66
67
68
69
70
71
    return (control: AbstractControl): { [key: string]: any } => {
        const input = control.value,
            isValid = input > 99;
        if (isValid)
            return { "maxValue": { max } };
        else
            return null;
    };
Open Source Developer's avatar
Open Source Developer committed
72
}
Open Source Developer's avatar
Open Source Developer committed
73
74

export function minValue(min: Number): ValidatorFn {
75
76
77
78
79
80
81
82
    return (control: AbstractControl): { [key: string]: any } => {
        const input = control.value,
            isValid = input < 1;
        if (isValid)
            return { "minValue": { min } };
        else
            return null;
    };
Open Source Developer's avatar
Open Source Developer committed
83
}