diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 3784c61..ae3367c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,6 +1,7 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
+import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { ContactSidebarComponent } from './contact-sidebar/contact-sidebar.component';
@@ -29,7 +30,8 @@ import { SpinnerComponent } from './spinner/spinner.component';
imports: [
BrowserModule,
HttpClientModule,
- AppRoutingModule
+ AppRoutingModule,
+ FormsModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
providers: [httpInterceptorProviders],
diff --git a/src/app/contact/contact.component.html b/src/app/contact/contact.component.html
index 03850a6..e303ae5 100644
--- a/src/app/contact/contact.component.html
+++ b/src/app/contact/contact.component.html
@@ -16,21 +16,36 @@
-
diff --git a/src/app/contact/contact.component.scss b/src/app/contact/contact.component.scss
index e69de29..c405d04 100644
--- a/src/app/contact/contact.component.scss
+++ b/src/app/contact/contact.component.scss
@@ -0,0 +1,20 @@
+.messageSentError {
+ margin:25px 0;
+ color: rgb(206, 87, 7);
+ font-size: 18px;
+ text-align: center;
+}
+
+.messageSentSuccess{
+ margin:25px 0;
+ color: green;
+ font-size: 18px;
+ text-align: center;
+}
+
+em.error{
+ padding: 2px 5px;
+ color: rgb(206, 87, 7);
+ //color: white;
+ font-style: normal;
+}
\ No newline at end of file
diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts
index dfb0ad1..89ba902 100644
--- a/src/app/contact/contact.component.ts
+++ b/src/app/contact/contact.component.ts
@@ -1,7 +1,6 @@
import { Component, OnInit } from '@angular/core';
-import { BaseComponent } from '../base/base.component';
import { CvService } from '../services/cv.service';
-import { ISideBar } from '../contact-sidebar/side-bar.model';
+import { IContact } from './contact.model';
@Component({
selector: 'app-contact',
@@ -9,6 +8,21 @@ import { ISideBar } from '../contact-sidebar/side-bar.model';
styleUrl: './contact.component.scss'
})
export class ContactComponent {
- constructor(svc: CvService){
+ messageModel: IContact = {name: '', fromEmail: '', content: '' };
+ candidateId: number = 1;
+ messageSentError: boolean = false;
+ messageSentSuccess: boolean = false;
+
+ constructor(private svc: CvService){
+ }
+
+ sendMessage() :void{
+ this.messageSentError = false;
+ this.messageSentSuccess = false;
+
+ this.svc.sendMessage(this.messageModel, this.candidateId).subscribe({
+ next: (response) => this.messageSentSuccess = response,
+ error: () => this.messageSentError = true
+ });
}
}
diff --git a/src/app/contact/contact.model.ts b/src/app/contact/contact.model.ts
new file mode 100644
index 0000000..d69e212
--- /dev/null
+++ b/src/app/contact/contact.model.ts
@@ -0,0 +1,5 @@
+export interface IContact{
+ name: string;
+ fromEmail: string;
+ content: string;
+}
\ No newline at end of file
diff --git a/src/app/services/cv.service.ts b/src/app/services/cv.service.ts
index ac2be0a..a7f86d3 100644
--- a/src/app/services/cv.service.ts
+++ b/src/app/services/cv.service.ts
@@ -7,6 +7,7 @@ import { IResume } from '../resume/resume.model';
import { IBlog } from '../blog/blog.model';
import { IProjects } from '../projects/projects.model';
import { ISideBar } from '../contact-sidebar/side-bar.model';
+import { IContact } from '../contact/contact.model';
@Injectable({
providedIn: 'root'
@@ -63,4 +64,8 @@ export class CvService {
}
return this.http.get(`/api/v1/cv/GetBlog/${candidateId}`);
}
+
+ sendMessage(contact: IContact, candidateId: number): Observable {
+ return this.http.post(`/api/v1/cv/SendMessage/${candidateId}`, contact);
+ }
}
diff --git a/src/styles.scss b/src/styles.scss
index 46873e7..b72ca5a 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -1173,6 +1173,10 @@
height: 120px;
max-height: 200px;
resize: vertical;
+ // margin-bottom: 25px;
+ }
+
+ div.text-area{
margin-bottom: 25px;
}
@@ -1533,7 +1537,8 @@
.form-input { padding: 15px 20px; }
- textarea.form-input { margin-bottom: 30px; }
+ // textarea.form-input { margin-bottom: 30px; }
+ div.textarea { margin-bottom: 30px; }
.form-btn {
--fs-6: 16px;