diff --git a/src/app/actions/knowledge.ts b/src/app/actions/knowledge.ts index 841bbaf2de..22d8321a7f 100644 --- a/src/app/actions/knowledge.ts +++ b/src/app/actions/knowledge.ts @@ -1,18 +1,22 @@ import { Action } from '@ngrx/store'; import { type } from '../utils'; + export const ActionTypes = { CONTENT_CHANGE: type('[Knowledge] Content Change'), IMAGE_CHANGE: type('[Knowledge] Image Change'), DESCRIPTION_CHANGE: type('[Knowledge] Description Change') }; + export class SearchContentAction implements Action { type = ActionTypes.CONTENT_CHANGE; constructor(public payload: object) {} } + export class SearchImageAction implements Action { type = ActionTypes.IMAGE_CHANGE; constructor(public payload: object) {} } + export class DescriptionAction implements Action { type = ActionTypes.DESCRIPTION_CHANGE; constructor(public payload: object) {} diff --git a/src/app/actions/query.ts b/src/app/actions/query.ts index 487726d4ec..871830ef26 100644 --- a/src/app/actions/query.ts +++ b/src/app/actions/query.ts @@ -8,13 +8,11 @@ export const ActionTypes = { export class QueryAction implements Action { type = ActionTypes.QUERYCHANGE; - constructor(public payload: any) {} } export class QueryServerAction implements Action { type = ActionTypes.QUERYSERVER; - constructor(public payload: any) {} } diff --git a/src/app/actions/search.ts b/src/app/actions/search.ts index 691ba2ba5c..45c77f8da3 100644 --- a/src/app/actions/search.ts +++ b/src/app/actions/search.ts @@ -10,25 +10,21 @@ export const ActionTypes = { export class SearchAction implements Action { type = ActionTypes.CHANGE; - constructor(public payload: any) {} } export class ItemsAction implements Action { type = ActionTypes.ITEMS; - constructor(public payload: any) {} } export class TotalResultsAction implements Action { type = ActionTypes.TOTALRESULTS; - constructor(public payload: any) {} } export class NavigationAction implements Action { type = ActionTypes.NAVIGATION; - constructor(public payload: any) {} } diff --git a/src/app/actions/speech.ts b/src/app/actions/speech.ts index f63ed4d86e..910b1d4063 100644 --- a/src/app/actions/speech.ts +++ b/src/app/actions/speech.ts @@ -7,7 +7,6 @@ export const ActionTypes = { export class SearchAction implements Action { type = ActionTypes.CHANGE; - constructor(public payload: any) {} } diff --git a/src/app/contact/contact.component.css b/src/app/contact/contact.component.css index c5526c6e17..9dc173bad3 100644 --- a/src/app/contact/contact.component.css +++ b/src/app/contact/contact.component.css @@ -34,17 +34,6 @@ padding-left: 20px; } -.navbar-text { - padding-right: 30px; - font-size: 20px; - margin-top: 6px; -} - -.text-center { - text-align: center; - font-family: "Quicksand", sans-serif; -} - .bold { font-weight: 700; } @@ -68,12 +57,6 @@ footer{ } } - -.about-navbar { - position: relative; - top: -5px; -} - .navbar { margin-bottom: 0px !important; } @@ -131,10 +114,6 @@ footer{ font-size: 24px; } -.navbar-fixed-bottom, .navbar-fixed-top{ - position: relative !important; -} - .contact-title{ border-bottom: 1px solid #eee; } diff --git a/src/app/contact/contact.component.html b/src/app/contact/contact.component.html index 3c2e45565d..156fb02739 100644 --- a/src/app/contact/contact.component.html +++ b/src/app/contact/contact.component.html @@ -4,17 +4,15 @@
- - +
- -
+
-
+

Contact Us

-
+
- -
+ +
Susper
-

93 Mau Than Street
Can Tho
Viet Nam
Phone +84 (0) 907 65 29 27
Email: support@susper.net
Board - of Directors: Hong Phuc Dang
Susper Ltd. is registered in Can Tho, Viet Nam.

+

+ 93 Mau Than Street
+ Can Tho
+ Viet Nam
+ Phone +84 (0) 907 65 29 27
+ Email: support@susper.net
Board of Directors: Hong Phuc Dang
+ Susper Ltd. is registered in Can Tho, Viet Nam. +

-
- -
- + +
+
-
-

Report a safety or abuse issue affecting our products.
If you know of a safety or abuse problem with any of Susper's - services, we'd like to hear about it right away. Please use our contact form to report the - issue. +

+ Report a safety or abuse issue affecting our products.
+ If you know of a safety or abuse problem with any of Susper's services, we'd like to + hear about it right away. Please use our contact form to + report the issue.

-
-
- - - + + + + + +
+
- - -
- -
- -
+ +
- Contact Form - -
- - -
- + Contact Form + +
+ + +
+ +
-
- -
- - -
- + +
+ + +
+ +
-
- -
- - -
- - - - + +
+ + +
+ + + +
-
- -
- - -
- + +
+ + +
+ +
- -
- -
- - -
- + +
+ + +
+ +
- -
-
-
- -
+ +
diff --git a/src/app/contact/contact.component.spec.ts b/src/app/contact/contact.component.spec.ts index 01223d2b24..0071cafd00 100644 --- a/src/app/contact/contact.component.spec.ts +++ b/src/app/contact/contact.component.spec.ts @@ -8,9 +8,10 @@ import { HttpModule } from '@angular/http'; import { FormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; -import { ContactComponent } from '../contact/contact.component'; +import { ContactComponent } from './contact.component'; import { FooterNavbarComponent } from '../footer-navbar/footer-navbar.component'; import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal'; +import { validateMessage, validatePhone, validateEmail, validateName } from '../utils'; describe('Component: Contact', () => { let component: ContactComponent; @@ -18,18 +19,9 @@ describe('Component: Contact', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [ - HttpModule, - RouterTestingModule, - FormsModule - ], - declarations: [ - FooterNavbarComponent, - ContactComponent, - ModalComponent, - ] - }) - .compileComponents(); + imports: [HttpModule, RouterTestingModule, FormsModule], + declarations: [FooterNavbarComponent, ContactComponent, ModalComponent], + }).compileComponents(); })); beforeEach(() => { @@ -68,4 +60,27 @@ describe('Component: Contact', () => { expect(compiled.querySelector('app-footer-navbar')).toBeTruthy(); }); + it('validates messages correctly', () => { + expect(validateMessage('abc')).toBe(false); + expect( + validateMessage( + 'fdasfdasfsdaffffffffffffffffffffffffffffffasdfsafasdfadfdasfdasfsdaffffffffffffffffffffffffffffffasdfsafasdfad' + ) + ).toBe(true); + }); + + it('validates phone number correctly', () => { + expect(validatePhone('1234567890')).toBe(true); + expect(validatePhone('123450')).toBe(false); + }); + + it('validates name correctly', () => { + expect(validateName('susper')).toBe(true); + expect(validateName('')).toBe(false); + }); + + it('validates email correctly', () => { + expect(validateEmail('susper@gmail.com')).toBe(true); + expect(validateEmail('fdasfdasf')).toBe(false); + }); }); diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts index 05dfda9285..c0002db0fb 100644 --- a/src/app/contact/contact.component.ts +++ b/src/app/contact/contact.component.ts @@ -1,78 +1,49 @@ -import { Component, ViewChild, OnInit, DoCheck } from '@angular/core'; +import { Component, ViewChild, OnInit } from '@angular/core'; import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal'; +import { validatePhone, validateEmail, validateMessage, validateName, countryCodeList } from '../utils'; + @Component({ - selector: 'app-contact', - templateUrl: './contact.component.html', - styleUrls: ['./contact.component.css'] + selector: 'app-contact', + templateUrl: './contact.component.html', + styleUrls: ['./contact.component.css'], }) -export class ContactComponent implements OnInit, DoCheck { - - @ViewChild('submitButton') submitButton; - - emailInput: string; - nameInput: string; - tpnoInput: number; - contactMessage: string = ''; - - @ViewChild('myModal') - modal: ModalComponent; - - constructor() { } - - ngOnInit() { - } - - close() { - this.modal.close(); - } - - open() { - this.modal.open(); - } - - ngDoCheck() { - this.checkValidity(); - } - - checkValidity() { - if (this.validateEmail(this.emailInput) && this.validatePhone(this.tpnoInput) && this.validateMessage(this.contactMessage) && this.validateName(this.nameInput)) { - this.submitButton.nativeElement.disabled = false; - } else { - this.submitButton.nativeElement.disabled = true; - } - } - - validateMessage(message) { - if (message && (message.length >= 100)) { - return true; - } else { - return false; - } - } - - validatePhone(phone) { - if (phone && (phone.toString().length >= 10)) { - return true; - } else { - return false; - } - } - - validateEmail(email) { - if (email) { - let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return re.test(email); - } else { - return false; - } - } - - validateName(name) { - if (name && (name.length > 0)) { - return true; - } else { - return false; - } - } - +export class ContactComponent implements OnInit { + @ViewChild('submitButton') submitButton; + + emailInput: string; + nameInput: string; + phoneNumberInput: number; + contactMessage: string; + countryCodeList: any; + + @ViewChild('ContactUsModal') + modal: ModalComponent; + + constructor() {} + + ngOnInit() { + this.contactMessage = ''; + this.countryCodeList = countryCodeList; + } + + closeModal() { + this.modal.close(); + } + + openModal() { + this.modal.open(); + } + + checkValidity() { + if ( + validateEmail(this.emailInput) && + validatePhone(this.phoneNumberInput) && + validateMessage(this.contactMessage) && + validateName(this.nameInput) + ) { + this.submitButton.nativeElement.disabled = false; + } else { + this.submitButton.nativeElement.disabled = true; + } + } } diff --git a/src/app/dropdown/dropdown.component.html b/src/app/dropdown/dropdown.component.html index 3f9ee43a6c..689c8d1097 100644 --- a/src/app/dropdown/dropdown.component.html +++ b/src/app/dropdown/dropdown.component.html @@ -8,13 +8,14 @@ diff --git a/src/app/help/help.component.html b/src/app/help/help.component.html index 9c7afd6336..0661d5f11d 100644 --- a/src/app/help/help.component.html +++ b/src/app/help/help.component.html @@ -147,21 +147,21 @@

- +
- +
- +
- +
- +
- +
- +
- +
- +