Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wantero authored Apr 23, 2020
2 parents 1eefea8 + 36a2e15 commit 2d89b8d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 82 deletions.
81 changes: 21 additions & 60 deletions src/app/components/account/account.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,8 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].street.touched &&
!formGroup['controls'].Address['controls'].street.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].street.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].street.touched && !formGroup['controls'].Address['controls'].street.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].street.hasError('required')">
Endereço obrigatório.
</small>
</div>
Expand All @@ -163,16 +155,8 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].number.touched &&
!formGroup['controls'].Address['controls'].number.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].number.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].number.touched && !formGroup['controls'].Address['controls'].number.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].number.hasError('required')">
Número obrigatório.
</small>
</div>
Expand All @@ -197,16 +181,8 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].neighborhood.touched &&
!formGroup['controls'].Address['controls'].neighborhood.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].neighborhood.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].neighborhood.touched && !formGroup['controls'].Address['controls'].neighborhood.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].neighborhood.hasError('required')">
Bairro obrigatório.
</small>
</div>
Expand All @@ -221,16 +197,8 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].city.touched &&
!formGroup['controls'].Address['controls'].city.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].city.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].city.touched && !formGroup['controls'].Address['controls'].city.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].city.hasError('required')">
Cidade obrigatório.
</small>
</div>
Expand All @@ -245,16 +213,8 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].state.touched &&
!formGroup['controls'].Address['controls'].state.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].state.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].state.touched && !formGroup['controls'].Address['controls'].state.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].state.hasError('required')">
Estado obrigatório.
</small>
</div>
Expand All @@ -269,22 +229,23 @@ <h1 class="text-center display-4">Editar Perfil</h1>
</div>
</div>

<div
*ngIf="
formGroup['controls'].Address['controls'].country.touched &&
!formGroup['controls'].Address['controls'].country.valid
"
>
<small
class="form-text text-danger"
*ngIf="formGroup['controls'].Address['controls'].country.hasError('required')"
>
<div *ngIf="formGroup['controls'].Address['controls'].country.touched && !formGroup['controls'].Address['controls'].country.valid">
<small class="form-text text-danger" *ngIf="formGroup['controls'].Address['controls'].country.hasError('required')">
País obrigatório.
</small>
</div>
</div>
</div>

<div class="form-group col-md-6 offset-md-3 mb-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" formControlName="allowSendingEmail" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Aceito receber e-mails e newletter do Sharebook
</label>
</div>
</div>

<div class="form-group col-md-6 offset-md-3">
<div class="text-center">
<input
Expand Down
1 change: 1 addition & 0 deletions src/app/components/account/account.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class AccountComponent implements OnInit, OnDestroy {
email: userInfo.email,
phone: userInfo.phone,
linkedin: userInfo.linkedin,
allowSendingEmail: [true, null],
Address: {
postalCode: userInfo.address.postalCode,
street: userInfo.address.street,
Expand Down
8 changes: 8 additions & 0 deletions src/app/components/register/register.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ <h1 class="text-center display-4">Registro</h1>
</small>
</div>
</div>
<div class="form-group col-md-6 offset-md-3 mb-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" formControlName="allowSendingEmail" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
Aceito receber e-mails e newletter do Sharebook
</label>
</div>
</div>

<div class="form-group col-md-6 offset-md-3">
<div class="text-center">
Expand Down
44 changes: 22 additions & 22 deletions src/app/components/register/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ export class RegisterComponent implements OnInit, OnDestroy {
private _AddressService: AddressService,
private _toastr: ToastrService
) {
this.formGroup = _formBuilder.group(
{
name: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(200)]],
email: ['', [Validators.required, Validators.pattern(AppConst.emailPattern)]],
password: ['', [Validators.required, Validators.minLength(6), Validators.maxLength(32)]],
confirmPassword: ['', [Validators.required]],
phone: ['', [Validators.required, Validators.pattern(AppConst.phonePattern)]],
linkedin: ['', [Validators.pattern(AppConst.linkedInUrlPattern)]],
postalCode: ['', [Validators.required, Validators.pattern(AppConst.postalCodePattern)]],
street: ['', [Validators.required]],
number: ['', [Validators.required]],
complement: [''],
neighborhood: ['', [Validators.required]],
city: ['', [Validators.required]],
state: ['', [Validators.required]],
country: ['', [Validators.required]]
},
{
validator: PasswordValidation.MatchPassword
}
);

this.formGroup = _formBuilder.group({
name: ['', [Validators.required, Validators.minLength(3), Validators.maxLength(200)]],
email: ['', [Validators.required, Validators.pattern(AppConst.emailPattern)]],
password: ['', [Validators.required, Validators.minLength(6), Validators.maxLength(32)]],
confirmPassword: ['', [Validators.required]],
phone: ['', [Validators.required, Validators.pattern(AppConst.phonePattern)]],
linkedin: ['', [Validators.pattern(AppConst.linkedInUrlPattern)]],
postalCode: ['', [Validators.required, Validators.pattern(AppConst.postalCodePattern)]],
street: ['', [Validators.required]],
number: ['', [Validators.required]],
complement: [''],
neighborhood: ['', [Validators.required]],
city: ['', [Validators.required]],
state: ['', [Validators.required]],
country: ['', [Validators.required]],
allowSendingEmail: [true, null]
}, {
validator: PasswordValidation.MatchPassword
});

}

ngOnInit() {}
Expand All @@ -66,7 +66,7 @@ export class RegisterComponent implements OnInit, OnDestroy {
.subscribe(
data => {
if (data.success || data.authenticated) {
this._toastr.success('Registro realizado com sucesso1');
this._toastr.success('Registro realizado com sucesso');
this._router.navigate(['/']);
} else {
this._toastr.error(data.messages[0]);
Expand Down
1 change: 1 addition & 0 deletions src/app/core/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export class User {
profile: Profile;
address: Address;
creationDate: Date;
allowSendingEmail: boolean;
}

0 comments on commit 2d89b8d

Please sign in to comment.