File tree Expand file tree Collapse file tree 5 files changed +20
-15
lines changed Expand file tree Collapse file tree 5 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -11,23 +11,24 @@ <h2 class="heading heading--primary">{{ 'contact-header' | translate }}</h2>
11
11
</ header >
12
12
</ div >
13
13
< div class ="contact__col ">
14
- < form class ="contact__form " (ngSubmit) ="sendMessage() ">
14
+ < form class ="contact__form " (ngSubmit) ="sendMessage() " ngNativeValidate >
15
15
< div class ="contact__input-box ">
16
16
< label for ="email " class ="contact__input-label "> {{ 'email' | translate }}</ label >
17
- < input type ="email " id ="email " class ="contact__input-input " placeholder ="{{ 'email-placeholder' | translate }} " [(ngModel)] ="email " name ="email " required >
17
+ < input type ="email " id ="email " class ="contact__input-input " placeholder ="{{ 'email-placeholder' | translate }} " [(ngModel)] ="email " name ="email " required ="" >
18
18
</ div >
19
19
< div class ="contact__input-box ">
20
20
< label for ="phone " class ="contact__input-label "> {{ 'phone' | translate }}</ label >
21
21
< input type ="tel " id ="phone " class ="contact__input-input " placeholder ="+48 795 691 258 " [(ngModel)] ="phone " name ="phone ">
22
22
</ div >
23
23
< div class ="contact__input-box ">
24
24
< label for ="message " class ="contact__input-label "> {{ 'message' | translate }}</ label >
25
- < textarea id ="message " class ="contact__input-textarea " placeholder ="{{ 'message-placeholder' | translate }} " [(ngModel)] ="message " name ="message "> </ textarea >
25
+ < textarea id ="message " class ="contact__input-textarea " placeholder ="{{ 'message-placeholder' | translate }} " [(ngModel)] ="message " name ="message " required > </ textarea >
26
26
</ div >
27
27
< button type ="submit " class ="button button--primary ">
28
28
< span class ="button-text "> {{ 'send' | translate }}</ span >
29
29
< span class ="button-icon button-icon--right "> ▼</ span >
30
30
</ button >
31
+ < p *ngIf ="success " class ="contact__header-paragraph "> {{ 'send-text' | translate }}</ p >
31
32
</ form >
32
33
</ div >
33
34
</ section >
Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
- import { HttpClient , HttpHeaders } from '@angular/common/http' ;
2
+ import { HttpClient } from '@angular/common/http' ;
3
3
4
4
@Component ( {
5
5
selector : 'app-contact' ,
@@ -10,22 +10,24 @@ export class ContactComponent implements OnInit {
10
10
email : string ;
11
11
phone : string ;
12
12
message : string ;
13
+ success : boolean ;
13
14
14
15
constructor ( private http : HttpClient ) { }
15
16
16
17
ngOnInit ( ) {
17
18
}
18
19
19
20
async sendMessage ( ) {
20
- const params = {
21
- email : this . email ,
22
- phone : this . phone ,
23
- message : this . message
24
- } ;
25
- const response = await this . http . post ( 'http://localhost:3000/api/message/add' , params , {
26
- headers : new HttpHeaders ( {
27
- 'Content-Type' : 'application/json'
28
- } )
29
- } ) ;
21
+ const params = new FormData ( ) ;
22
+ params . append ( 'email' , this . email ) ;
23
+ params . append ( 'message' , this . message ) ;
24
+ params . append ( 'phone' , this . phone ) ;
25
+ console . log ( 'send msg' , params ) ;
26
+
27
+ this . http
28
+ . post ( 'https://tymdev.pl/api/routes/sendMail.php' , params )
29
+ . subscribe ( ( ) => {
30
+ this . success = true ;
31
+ } ) ;
30
32
}
31
33
}
Original file line number Diff line number Diff line change 22
22
< span (click) ="scrollToElement('contact') "> {{ 'contact' | translate }}</ span >
23
23
</ li >
24
24
< li >
25
- < a href ="http://tymdev.pl/admin "> {{ 'clientsInNav' | translate }}</ a >
25
+ < a href ="http://admin. tymdev.pl "> {{ 'clientsInNav' | translate }}</ a >
26
26
</ li >
27
27
</ ul >
28
28
</ div >
Original file line number Diff line number Diff line change 26
26
"message" : " Message" ,
27
27
"message-placeholder" : " Hey! We would like to have you in our team. Check out our job offer and join us!" ,
28
28
"send" : " Send" ,
29
+ "send-text" : " Send! Thank you for contacting me!" ,
29
30
"company" : " Ltd." ,
30
31
"contact" : " Contact"
31
32
}
Original file line number Diff line number Diff line change 26
26
"message" : " Wiadomość" ,
27
27
"message-placeholder" : " Hej! Chcielibyśmy mieć Cie w naszym zespole. Sprawdź naszą ofertę pracy i dołącz do nas!" ,
28
28
"send" : " Wyślij" ,
29
+ "send-text" : " Wysłano! Dziękujemy za kontakt!" ,
29
30
"company" : " sp. z o. o." ,
30
31
"contact" : " Kontakt"
31
32
}
You can’t perform that action at this time.
0 commit comments