aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/profile-settings/profile-settings.component.html
blob: 9e0e80ec962b8f51783319e09d70df68188ddd07 (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
<app-navbar></app-navbar>

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

<div id="content" class="scroll-standalone under-navbar" *ngIf="dataArrived">
	<nav id="navigation">
		<button class="submit-btn" (click)="goToProfile()">ᐊ Back</button>
		<button class="submit-btn" (click)="navigateToAdminPanel()" *ngIf="isAdminUser">Panel</button>
		<button class="submit-btn" (click)="logout()">Logout</button>
	</nav>
	<hr>
	<div class="scroll-standalone">
		<form id="update-profile-picture" [formGroup]="updateProfilePictureFormGroup" (ngSubmit)="updateProfilePicture()">
			<img id="profile-picture" class="round-image" [src]="user.profilePictureURL">
			<div id="submit-file">
				<div id="upload-file" class="submit-btn">
					<input type="file" accept="image/*" formControlName="fileUpload" (change)="onFileUpload($event)">
				</div>
				<button class="submit-btn" type="submit">Update profile picture</button>
			</div>
		</form>
		<hr>
		<form id="update-user" [formGroup]="updateUserFormGroup" (ngSubmit)="onSubmit()">
			<div class="input-selection">
				<input type="text" class="input-field" formControlName="firstName" required>
				<label class="input-field-label">First Name</label>

				<div class="input-errors">
					<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>
			</div>

			<div class="input-selection">
				<input type="text" class="input-field" formControlName="lastName" required>
				<label class="input-field-label">Last Name</label>

				<div class="input-errors">
					<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>
			</div>

			<div class="input-selection">
				<input type="text" class="input-field" formControlName="username" required>
				<label class="input-field-label">Username</label>

				<div class="input-errors">
					<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>
			</div>

			<div class="input-selection">
				<input type="text" class="input-field" formControlName="email" required>
				<label class="input-field-label">Email</label>

				<div class="input-errors">
					<label *ngIf="updateUserFormGroup.get('email')?.errors?.required" class="error">*Required</label>
					<label *ngIf="updateUserFormGroup.get('email')?.errors?.email" class="error">*Invalid email</label>
				</div>
			</div>

			<div class="input-selection">
				<input type="password" class="input-field" formControlName="password" required>
				<label class="input-field-label">Password</label>

				<div class="input-errors">
					<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>
			</div>
			<button type="button" class="submit-btn edit-btn" (click)="toggleLanguages()">▼ Edit Languages ▼</button>
			<div *ngIf="showLanguages">
				<div class="input-selection">
					<input type="text" class="input-field" formControlName="languageInput" required>

					<div class="input-errors">
						<label class="error">Type in your desired languages, separated by a space</label>
					</div>
				</div>
				Available languages:
				<div id="all-languages">
					<div class="user-language" *ngFor="let lang of availableLanguages">
						{{ lang.name }}
					</div>
				</div>
			</div>

			<button type="button" class="submit-btn edit-btn" (click)="toggleTechnologies()">▼ Edit Technologies ▼</button>
			<div *ngIf="showTechnologies">
				<div class="input-selection">
					<input type="text" class="input-field" formControlName="technologyInput" required>

					<div class="input-errors">
						<label class="error">Type in your desired technologies, separated by a space</label>
					</div>
				</div>
				Available technologies:
				<div id="all-technologies">
					<div class="user-technology" *ngFor="let tech of availableTechnologies">
						{{ tech.name }}
					</div>
				</div>
			</div>

			<button id="update-profile-btn" class="submit-btn" type="submit">Update profile</button>
			<app-success-bar></app-success-bar>
			<app-error-bar></app-error-bar>
		</form>
		<hr>
		<div id="confirm-delete" *ngIf="deleteAccountConfirm">
			Are you sure you want to delete your account?<br>This is permanent!
		</div>
		<button class="submit-btn delete-btn" (click)="deleteAccount()">Delete account</button>
	</div>
</div>