diff --git a/libs/common-docs/src/common-docs.module.ts b/libs/common-docs/src/common-docs.module.ts index 8b7728da8..415b166f6 100644 --- a/libs/common-docs/src/common-docs.module.ts +++ b/libs/common-docs/src/common-docs.module.ts @@ -30,6 +30,7 @@ import { UtilService } from './services/utils.service'; import { TechnologiesCardComponent } from './components/technologies-card/technologies-card.component'; import { TechnologiesComponent } from './components/technologies/technologies.component'; import { CookieConsentBannerComponent } from './components/cookie-consent-banner/cookie-consent-banner.component'; +import { MatSelectModule } from '@angular/material/select'; export { PopoverComponent } from './components/popover/popover.component'; export { TopMenuComponent } from './components/top-menu/top-menu.component'; @@ -95,7 +96,8 @@ export { CookieConsentBannerComponent } from './components/cookie-consent-banner HttpClientModule, FileUploaderModule, SwiperModule, - RecaptchaV3Module + RecaptchaV3Module, + MatSelectModule ], exports: [ TopMenuComponent, diff --git a/libs/common-docs/src/components/contact-modal/contact-modal.component.html b/libs/common-docs/src/components/contact-modal/contact-modal.component.html index 83fc26a31..3721cea39 100644 --- a/libs/common-docs/src/components/contact-modal/contact-modal.component.html +++ b/libs/common-docs/src/components/contact-modal/contact-modal.component.html @@ -93,34 +93,30 @@

-
+

Your job role (optional)

- - - - - {{ validation.message }} - - + + None + + {{option.value}} + +
-
+

Size of the company (optional)

- - - - - {{ validation.message }} - - + + None + + {{option.value}} + +
diff --git a/libs/common-docs/src/components/contact-modal/contact-modal.component.scss b/libs/common-docs/src/components/contact-modal/contact-modal.component.scss index 83f90379e..edd5f91e2 100644 --- a/libs/common-docs/src/components/contact-modal/contact-modal.component.scss +++ b/libs/common-docs/src/components/contact-modal/contact-modal.component.scss @@ -98,3 +98,36 @@ $bp-medium: 768px; background-color: #E24E63 !important; } } + +::ng-deep .cdk-overlay-pane .mat-mdc-select-panel { + --tw-bg-opacity: 1; + background-color: rgba(39, 39, 39, var(--tw-bg-opacity)); + + mat-option { + color: white; + } +} + +::ng-deep .mat-mdc-select-value { + color: white; + + .mat-mdc-select-placeholder { + opacity: 0.4; + color: #a1a1aa; + } +} + +::ng-deep .mat-mdc-select-arrow svg { + opacity: 0.4; + color: #a1a1aa; +} + +::ng-deep .mat-mdc-select-trigger { + padding: 16px; +} + +.select { + .text-input { + padding: 0; + } +} diff --git a/libs/common-docs/src/components/contact-modal/contact-modal.components.ts b/libs/common-docs/src/components/contact-modal/contact-modal.components.ts index 7e2209797..18f2c20b2 100644 --- a/libs/common-docs/src/components/contact-modal/contact-modal.components.ts +++ b/libs/common-docs/src/components/contact-modal/contact-modal.components.ts @@ -22,6 +22,10 @@ interface ContactModalForm { ['g-recaptcha-response']: FormControl; } +interface Option { + value: string; +} + const emailRegex = /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/; const textRegex = /^(?! +$)[a-zA-Z0-9\-_ ']+$/; const commentRegex = /^(?!\s*$).+/; @@ -37,8 +41,49 @@ export class ContactModalComponent implements OnDestroy { showSuccessModalState = false; showErrorModalState = false; submitErrorMessage = ''; + jobTitleOptions: Option[] = [ + { + value: 'Sales Manager' + }, + { + value: 'Product Manager' + }, + { + value: 'Project Manager' + }, + { + value: 'HR' + }, + { + value: 'Designer' + }, + { + value: 'Engineer' + }, + { + value: 'CEO' + }, + { + value: 'Other' + }, + ]; + sizeOfCompanyOptions: Option[] = [ + { + value: '0-50' + }, + { + value: '50-200' + }, + { + value: '200-500' + }, + { + value: '500+' + } + ]; form = this._createForm(); + private _isFormSubmitted = false; readonly validationMessages = { firstName: [ { type: 'required', message: 'This field is required field' }, @@ -57,16 +102,6 @@ export class ContactModalComponent implements OnDestroy { { type: 'maxlength', message: 'Field must be less than 30 characters' }, { type: 'pattern', message: 'Please enter valid data' } ], - jobRole: [ - { type: 'minlength', message: 'Field must be longer than 2 characters' }, - { type: 'maxlength', message: 'Field must be less than 30 characters' }, - { type: 'pattern', message: 'Please enter valid data' } - ], - companySize: [ - { type: 'minlength', message: 'Field must be longer than 2 characters' }, - { type: 'maxlength', message: 'Field must be less than 30 characters' }, - { type: 'pattern', message: 'Please enter valid data' } - ], email: [ { type: 'required', message: 'This field is required field' }, { type: 'pattern', message: 'Please enter a valid email' } @@ -100,7 +135,7 @@ export class ContactModalComponent implements OnDestroy { private readonly sendEmailService: SendEmailService, private readonly recaptchaV3Service: ReCaptchaV3Service, private readonly router: Router, - private readonly _cdRef: ChangeDetectorRef + private readonly _cdRef: ChangeDetectorRef, ) { const element = document.body.querySelector('.grecaptcha-badge') as HTMLElement; if (element) { @@ -114,11 +149,19 @@ export class ContactModalComponent implements OnDestroy { element.style.display = 'none'; } + this._isFormSubmitted = false; this._internalSub.unsubscribe(); } closeModal() { - this.modalService.close(); + if (this._isFormSubmitted) { + this.modalService.close(); + return; + } + + if (!this._isFormSubmitted && window.confirm('Are you sure you want to close this window? All unsaved data will be lost?')) { + this.modalService.close(); + } } onSubmit() { @@ -132,6 +175,7 @@ export class ContactModalComponent implements OnDestroy { ) ).subscribe(() => { this.form.reset(); + this._isFormSubmitted = true; this.showSuccessModal(); this.recaptchaV3Service.execute(''); }, (error: IError) => { @@ -192,16 +236,8 @@ export class ContactModalComponent implements OnDestroy { Validators.minLength(2), Validators.pattern(textRegex) ]), - jobRole: new FormControl('', [ - Validators.maxLength(30), - Validators.minLength(2), - Validators.pattern(textRegex) - ]), - companySize: new FormControl('', [ - Validators.maxLength(30), - Validators.minLength(2), - Validators.pattern(textRegex) - ]), + jobRole: new FormControl(''), + companySize: new FormControl(''), companyServiceName: new FormControl(this._getDefaultCompanyServiceName()), comment: new FormControl('', [ Validators.maxLength(2000),