Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 54 additions & 55 deletions frontend/Exence/src/app/private/profile/profile.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<section class="d-flex flex-column h-100 justif-content-between p-2 pb-0 p-sm-3 p-md-4 gap-0">
<!-- Profile data -->
<div class="d-flex flex-column gap-4">
<form class="d-flex flex-column gap-4" [formGroup]="userDataForm" (submit)="saveUserData(); $event.preventDefault()">
<div class="d-flex flex-row flex-nowrap align-items-center justify-content-center justify-content-md-start gap-2">
<h3 class="m-0 text-center text-md-start fs-2">Profile data</h3>
<div class="d-flex flex-row flex-nowrap align-items-center justify-content-center gap-2">
Expand All @@ -12,8 +12,7 @@ <h3 class="m-0 text-center text-md-start fs-2">Profile data</h3>
collapsedStyle="filled"
collapseUnder="sm"
[disabled]="userDataForm.invalid"
type="button"
(click)="saveUserData()"
type="submit"
>
Save
</ex-button>
Expand All @@ -33,42 +32,41 @@ <h3 class="m-0 text-center text-md-start fs-2">Profile data</h3>
iconButton
matIcon="edit"
color="primary"
type="button"
(click)="isUserDataFormEditing.set(true)"
/>
}
</div>
</div>

<form [formGroup]="userDataForm">
<div class="d-flex flex-column flex-md-row gap-3 w-100 mb-2">
@let nameControl = userDataForm.controls.username;
<mat-form-field>
<mat-label>Username</mat-label>
<input matInput [formControl]="nameControl" />
<ex-input-clear matSuffix [control]="nameControl"/>
<mat-error>
<ex-validator [control]="nameControl" />
</mat-error>
</mat-form-field>
<div class="d-flex flex-column flex-md-row gap-3 w-100 mb-2">
@let nameControl = userDataForm.controls.username;
<mat-form-field>
<mat-label>Username</mat-label>
<input matInput [formControl]="nameControl" />
<ex-input-clear matSuffix [control]="nameControl"/>
<mat-error>
<ex-validator [control]="nameControl" />
</mat-error>
</mat-form-field>

@let emailControl = userDataForm.controls.email;
<mat-form-field>
<mat-label>Email</mat-label>
<input matInput type="email" [formControl]="emailControl" />
<ex-input-clear matSuffix [control]="emailControl" />
<mat-error>
<ex-validator [control]="emailControl" />
</mat-error>
</mat-form-field>
</div>
</form>
</div>
@let emailControl = userDataForm.controls.email;
<mat-form-field>
<mat-label>Email</mat-label>
<input matInput type="email" [formControl]="emailControl" />
<ex-input-clear matSuffix [control]="emailControl" />
<mat-error>
<ex-validator [control]="emailControl" />
</mat-error>
</mat-form-field>
</div>
</form>

<!-- Password -->
<div class="d-flex flex-column gap-4">
@if (isPasswordFormEditing()) {
<h3 class="m-0 text-center text-md-start fs-2">Change password</h3>
<form [formGroup]="passwordForm">
<form [formGroup]="passwordForm" (submit)="savePassword(); $event.preventDefault()">
<div class="d-flex flex-column gap-3 w-100">
@let pwdControl = passwordForm.controls.password;
<mat-form-field>
Expand Down Expand Up @@ -102,42 +100,43 @@ <h3 class="m-0 text-center text-md-start fs-2">Change password</h3>
</mat-form-field>
</div>
</div>

<div class="d-flex flex-column flex-md-row flex-nowrap align-items-center gap-2">
<ex-button
filled
color="primary"
matIcon="check"
[disabled]="passwordForm.invalid"
type="submit"
class="action-button"
>
Save
</ex-button>
<ex-button
outlined
color="accent"
matIcon="close"
type="button"
class="action-button"
(click)="cancelPasswordEditing()"
>
Cancel
</ex-button>
</div>

</form>
}
<div class="d-flex flex-column flex-md-row flex-nowrap align-items-center gap-2">
@if (isPasswordFormEditing()) {
<ex-button
filled
color="primary"
matIcon="check"
[disabled]="passwordForm.invalid"
type="button"
class="action-button"
(click)="savePassword()"
>
Save
</ex-button>
<ex-button
outlined
color="accent"
matIcon="close"
type="button"
class="action-button"
(click)="cancelPasswordEditing()"
>
Cancel
</ex-button>
} @else {
} @else {
<div class="d-flex">
<ex-button
filled
color="primary"
(click)="isPasswordFormEditing.set(true)"
class="action-button"
>
>
Change password
</ex-button>
}
</div>
</div>
}
</div>

<mat-divider />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,74 @@
<h3 class="fs-1 fw-bold">New category</h3>
</mat-card-header>

<mat-card-content class="d-flex flex-column gap-3">
@let nameControl = form.controls.name;
<mat-form-field>
<mat-label>Name</mat-label>
<input
matInput
[formControl]="nameControl"
/>
<ex-input-clear matSuffix [control]="nameControl" />
<mat-error>
<ex-validator [control]="nameControl" />
</mat-error>
</mat-form-field>
<form class="d-flex flex-column w-100" (submit)="create(); $event.preventDefault()" [formGroup]="form">
<mat-card-content class="d-flex flex-column gap-3">
@let nameControl = form.controls.name;
<mat-form-field>
<mat-label>Name</mat-label>
<input
matInput
[formControl]="nameControl"
/>
<ex-input-clear matSuffix [control]="nameControl" />
<mat-error>
<ex-validator [control]="nameControl" />
</mat-error>
</mat-form-field>

<div class="d-flex flex-column gap-2">
<div class="d-flex align-items-center gap-2">
<ex-button
filled
color="accent"
[matMenuTriggerFor]="emojiMenu"
class="w-100"
>
Select emoji
</ex-button>
<div class="selected-icon fs-5 position-relative">
<div class="default-content">
@if (form.value.emoji) {
{{ form.value.emoji }}
} @else {
<mat-icon class="grayscaled">do_not_disturb_none</mat-icon>
}
<div class="d-flex flex-column gap-2">
<div class="d-flex align-items-center gap-2">
<ex-button
filled
color="accent"
[matMenuTriggerFor]="emojiMenu"
class="w-100"
>
Select emoji
</ex-button>
<div class="selected-icon fs-5 position-relative">
<div class="default-content">
@if (form.value.emoji) {
{{ form.value.emoji }}
} @else {
<mat-icon class="grayscaled">do_not_disturb_none</mat-icon>
}
</div>
<div class="hover-content" (click)="form.controls.emoji.reset()">
<mat-icon>close</mat-icon>
</div>
</div>
<div class="hover-content" (click)="form.controls.emoji.reset()">
<mat-icon>close</mat-icon>
</div>
</div>
</div>
<!-- TODO use validator -->
@if (emojiInvalid) {
<div class="emoji-error">
Emoji is required!
</div>
}
<!-- TODO use validator -->
@if (emojiInvalid) {
<div class="emoji-error">
Emoji is required!
</div>
}
</div>
</mat-card-content>
</mat-card-content>

<mat-card-actions class="justify-content-end align-items-center gap-2 w-100 px-4 pt-0">
<ex-button
outline
color="accent"
matIcon="close"
(click)="close()"
>
Cancel
</ex-button>
<ex-button
filled
color="primary"
matIcon="add"
[disabled]="form.invalid"
(click)="create()"
>
Create
</ex-button>
</mat-card-actions>
<mat-card-actions class="justify-content-end align-items-center gap-2 w-100 px-4 pt-4">
<ex-button
outline
color="accent"
matIcon="close"
type="button"
(click)="close()"
>
Cancel
</ex-button>
<ex-button
filled
color="primary"
matIcon="add"
[disabled]="form.invalid"
type="submit"
>
Create
</ex-button>
</mat-card-actions>
</form>
</mat-card>

<mat-menu
Expand Down
Loading
Loading