Skip to content

Commit

Permalink
Bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oktawian-L committed Nov 4, 2019
1 parent 712de89 commit 0549ff0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
5 changes: 3 additions & 2 deletions Subiton/src/app/users/user-edit/user-edit.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ <h1>
</div>
<div class="card-footer">
<div class="btn-group d-flex">
<button [disabled]="!editForm.dirty" form="editForm" class="btn btn-success w-100"><i class="fa fa-save"></i> Save</button>
<button [disabled]="!editForm.dirty" form="editForm" class="btn btn-success w-100"><i
class="fa fa-save"></i> Save</button>
<button class="btn btn-warning w-100"><i class="fa fa-warning"></i> Cancel</button>
</div>
</div>
</div>
</div>
<div class="col-sm-8">
<form #editForm="ngForm" id="editForm" (ngSubmit)="updateUser()">
<form #editForm="ngForm" id="editForm" (ngSubmit)="updateUser(user)">
<div class="tab-panel">
<tabset class="user-tabset">
<tab heading="Edit information" id="profile_tab1">
Expand Down
17 changes: 8 additions & 9 deletions Subiton/src/app/users/user-edit/user-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export class UserEditComponent implements OnInit {

user: User;

galleryOptions: NgxGalleryOptions[];
galleryImages: NgxGalleryImage[];

@ViewChild('editForm', { static: false }) editForm: NgForm;

// random browser exit prevention, and show poup
Expand All @@ -38,7 +35,6 @@ export class UserEditComponent implements OnInit {
this.user = data.user;
});


this.galleryOptions = [
{
width: '100%',
Expand All @@ -49,7 +45,7 @@ export class UserEditComponent implements OnInit {
thumbnails: false,
imageAnimation: NgxGalleryAnimation.Slide,
previewZoomMax: 4,
previewZoomMin : 1,
previewZoomMin: 1,
previewRotate: true,
previewBullets: true
},
Expand Down Expand Up @@ -78,7 +74,7 @@ export class UserEditComponent implements OnInit {
const imageUrls = [];

// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < this.user.photos.length; i++) {
for (let i = 0; i < this.user.photos.length; i++) {
imageUrls.push({
small: this.user.photos[i].url,
medium: this.user.photos[i].url,
Expand All @@ -92,9 +88,12 @@ export class UserEditComponent implements OnInit {
}

// save chnages - edit profile
updateUser() {
this.userService.updateUser(this.user.id, this.user);
updateUser(formUser: User) {
console.log(this.editForm.updateModel);
console.log(this.editForm.value);
console.log(this.editForm.valueChanges);
this.userService.updateUser(this.user.id, this.editForm.value);
this.alertify.success('Succesfully saved changes.');
this.editForm.reset(this.user);
this.editForm.reset(this.editForm.value);
}
}

0 comments on commit 0549ff0

Please sign in to comment.