aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/profile-settings/profile-settings.component.html
blob: 538824d1059fe4900911efa57adef7cbd47df98c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<app-navbar></app-navbar>

<app-loading *ngIf="!dataArrived"></app-loading>

<main class="scroll-standalone under-navbar centered-content flex-col">
	<section class="card width-full" *ngIf="this.isAdminUser">
		<button class="width-full border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3" (click)="goToAdminPanel()">
			Go to admin panel
		</button>
	</section>
	<form class="flex-row card width-full font-size-dot9 margin-top-bot-dot7" [formGroup]="updateProfilePictureFormGroup" (ngSubmit)="updateProfilePicture()">
		<img id="profile-picture" class="round-image" [src]="user.profilePictureURL">
		<section class="flexible flex-col flex-center-align-items flex-justify-center padding-side-font">
			<input class="width-full border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3" type="file" accept="image/*" formControlName="fileUpload" (change)="onFileUpload($event)">
			<button class="width-full border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3 margin-top-dot4" type="submit" *ngIf="newProfilePicture.size > 0">
				Update profile picture
			</button>
		</section>
	</form>
	<form class="flex-col card width-full padding-dot6" [formGroup]="updateUserFormGroup" (ngSubmit)="onSubmit()">
		<section class="flex-col">
			<div class="flex-row">
				<label class="flexible fg-focus">First Name</label>

				<label *ngIf="updateUserFormGroup.get('firstName')?.errors?.required" class="error">*Required</label>
				<label *ngIf="updateUserFormGroup.get('firstName')?.errors?.minlength" class="error">*Minimum 3 characters</label>
			</div>
			<input type="text" class="fancy-input border-faded-slim border-bottom-only" formControlName="firstName" required>
		</section>
		<section class="flex-col">
			<div class="flex-row">
				<label class="flexible fg-focus">Last Name</label>

				<label *ngIf="updateUserFormGroup.get('lastName')?.errors?.required" class="error">*Required</label>
				<label *ngIf="updateUserFormGroup.get('lastName')?.errors?.minlength" class="error">*Minimum 3 characters</label>
			</div>
			<input type="text" class="fancy-input border-faded-slim border-bottom-only" formControlName="lastName" required>
		</section>
		<section class="flex-col">
			<div class="flex-row">
				<label class="flexible fg-focus">Username</label>

				<label *ngIf="updateUserFormGroup.get('username')?.errors?.required" class="error">*Required</label>
				<label *ngIf="updateUserFormGroup.get('username')?.errors?.minlength" class="error">*Minimum 3 characters</label>
			</div>
			<input type="text" class="fancy-input border-faded-slim border-bottom-only" formControlName="username" required>
		</section>
		<section class="flex-col">
			<div class="flex-row">
				<label class="flexible fg-focus">Email</label>

				<label *ngIf="updateUserFormGroup.get('email')?.errors?.required" class="error">*Required</label>
				<label *ngIf="updateUserFormGroup.get('email')?.errors?.email" class="error">*Invalid email</label>
			</div>
			<input type="text" class="fancy-input border-faded-slim border-bottom-only" formControlName="email" required>
		</section>
		<section class="flex-col">
			<div class="flex-row">
				<label class="flexible fg-focus">Password</label>

				<label *ngIf="updateUserFormGroup.get('password')?.errors?.required" class="error">*Required</label>
				<label *ngIf="updateUserFormGroup.get('password')?.errors?.minlength" class="error">*Minimum 3 characters</label>
				<label *ngIf="updateUserFormGroup.get('password')?.errors?.pattern" class="error">*At least 1 number</label>
			</div>
			<input type="password" class="fancy-input border-faded-slim border-bottom-only" formControlName="password" required>
		</section>
		<button type="button" class="fg-focus width-full border-faded-slim padding-dot3 lighter-hover click-effect margin-top-dot4" (click)="toggleLanguages()">
			▼ Edit Languages ▼
		</button>
		<section *ngIf="showLanguages">
			<div class="margin-top-dot5">
				<label class="error">
					Type in your desired languages, separated by a space
				</label>
				<input class="fancy-input width-full border-faded-slim border-bottom-only" type="text" placeholder="You have no selected languages!" formControlName="languageInput" required>
			</div>
			<div class="none-message" *ngIf="availableLanguages.length === 0">
				No languages available!
			</div>
			<div *ngIf="availableLanguages.length > 0">
				Available languages:
			</div>
			<div class="flex-row margin-top-dot4" *ngFor="let lang of availableLanguages">
				<div class="sec-info border-radius-dot5r padding-dot2">
					{{ lang.name }}
				</div>
			</div>
		</section>
		<button type="button" class="fg-focus width-full border-faded-slim padding-dot3 lighter-hover click-effect margin-top-dot4" (click)="toggleTechnologies()">
			▼ Edit Technologies ▼
		</button>
		<section *ngIf="showTechnologies">
			<div class="margin-top-dot5">
				<label class="error">
					Type in your desired technologies, separated by a space
				</label>
				<input class="fancy-input width-full border-faded-slim border-bottom-only" type="text" placeholder="You have no selected technologies!" formControlName="technologyInput" required>
			</div>
			<div class="none-message" *ngIf="availableTechnologies.length === 0">
				No technologies available!
			</div>
			<div *ngIf="availableTechnologies.length > 0">
				Available technologies:
			</div>
			<div class="flex-row margin-top-dot4" *ngFor="let tech of availableTechnologies">
				<div class="sec-info border-radius-dot5r padding-dot2">
					{{ tech.name }}
				</div>
			</div>
		</section>
		<section class="margin-top-bot-dot3">
			<app-success-bar></app-success-bar>
			<app-error-bar></app-error-bar>
		</section>
		<button class="width-full border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3" type="submit">
			Update profile
		</button>
	</form>
	<section class="card width-full">
		<div class="margin-bot-dot5 text-centered fg-error" *ngIf="deleteAccountConfirm">
			Are you sure you want to delete your account?<br>This is permanent!
		</div>
		<button class="width-full border-faded-slim padding-dot3 lighter-hover click-effect border-radius-dot3 fg-error" (click)="deleteAccount()">
			Delete account
		</button>
	</section>
	</main>