commit c9f649fda39a925163dcd1c30eb2790f3adceca8
Author: castic96 <zdenek.castoral.jr@gmail.com>
Date:   Sat May 16 00:56:22 2020 +0200

    Re #8027: Checkbox pro spell checker FE
    - vytvořen checkbox pro autocorrect

diff --git a/fe/fulltextsearch/src/app/app.module.ts b/fe/fulltextsearch/src/app/app.module.ts
index 3e66abe..3ded307 100644
--- a/fe/fulltextsearch/src/app/app.module.ts
+++ b/fe/fulltextsearch/src/app/app.module.ts
@@ -35,6 +35,7 @@ import { ImageViewerModule } from 'ngx-image-viewer';
 import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
 import { TranslateHttpLoader } from '@ngx-translate/http-loader';
 import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
+import {MatCheckboxModule} from '@angular/material/checkbox';
 
 export function HttpLoaderFactory(httpClient: HttpClient) {
   return new TranslateHttpLoader(httpClient, '../assets/i18n/', '-lang.json');
@@ -81,7 +82,8 @@ export function HttpLoaderFactory(httpClient: HttpClient) {
         useFactory: HttpLoaderFactory,
         deps: [HttpClient]
       }
-    })
+    }),
+    MatCheckboxModule
   ],
   providers: [DataHolderService, DatePipe],
   bootstrap: [AppComponent]
diff --git a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.css b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.css
index f54ec06..c93bddb 100644
--- a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.css
+++ b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.css
@@ -56,3 +56,13 @@ input:focus {
 .input-group-append .btn, .input-group-prepend .btn {
   z-index: 0 !important;
 }
+
+.input-group {
+  margin-bottom: 8pt !important;
+}
+
+.mat-checkbox {
+  padding: 6pt 6pt 1pt;
+  background-color: white !important;
+  color: var(--text-grey);
+}
diff --git a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.html b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.html
index 6f61adb..280d4f4 100644
--- a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.html
+++ b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.html
@@ -13,4 +13,5 @@
       <button class="btn btn-outline-secondary" type="button" (click)="onSubmit()">{{'app-search-box.search' | translate}}</button>
     </div>
   </div>
+    <mat-checkbox color="warn" (change)="onToggle()">{{'app-search-box.spell-check' | translate}}</mat-checkbox>
 </div>
diff --git a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.ts b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.ts
index c39995e..5c181c5 100644
--- a/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.ts
+++ b/fe/fulltextsearch/src/app/components/shared-components/search-box/search-box.component.ts
@@ -1,9 +1,9 @@
-import {Component, OnDestroy, OnInit} from '@angular/core';
+import { Component, OnDestroy, OnInit } from '@angular/core';
 import { SearchRequest } from '../../../model/SearchRequest';
 import { QueryService } from '../../../services/query/query.service';
 import { Router } from '@angular/router';
 import { DataHolderService } from '../../../services/data-holder/data-holder.service';
-import {Subscription} from 'rxjs';
+import { Subscription } from 'rxjs';
 
 @Component({
   selector: 'app-search-box',
@@ -11,19 +11,25 @@ import {Subscription} from 'rxjs';
   styleUrls: ['./search-box.component.css']
 })
 export class SearchBoxComponent implements OnInit, OnDestroy {
+  enableSpellCheck: boolean;
   expression: string;
   private queryServiceSubscription$: Subscription;
 
   constructor(private queryService: QueryService, private router: Router, private dataHolderService: DataHolderService) { }
 
   ngOnInit(): void {
+    this.enableSpellCheck = false;
+  }
+
+  onToggle() {
+    this.enableSpellCheck = !this.enableSpellCheck;
+    console.log('kontrola spell check: ' + this.enableSpellCheck);
   }
 
   onSubmit(): void {
     if (!this.expression) { return; }
 
-    const searchRequest: SearchRequest = new SearchRequest(this.expression, new Date());
-    console.log('odeslano: ' + JSON.stringify(searchRequest));
+    const searchRequest: SearchRequest = new SearchRequest(this.expression, new Date(), this.enableSpellCheck);
 
     this.queryServiceSubscription$ = this.queryService.searchPost(searchRequest).subscribe (data => {
       this.dataHolderService.setData(data);
@@ -34,9 +40,7 @@ export class SearchBoxComponent implements OnInit, OnDestroy {
   }
 
   ngOnDestroy(): void {
-    console.log(this.queryServiceSubscription$);
     if (this.queryServiceSubscription$ !== undefined) {
-      console.log('podminka');
       this.queryServiceSubscription$.unsubscribe();
     }
   }
diff --git a/fe/fulltextsearch/src/app/model/SearchRequest.ts b/fe/fulltextsearch/src/app/model/SearchRequest.ts
index 8212136..9e0bcbe 100644
--- a/fe/fulltextsearch/src/app/model/SearchRequest.ts
+++ b/fe/fulltextsearch/src/app/model/SearchRequest.ts
@@ -1,9 +1,11 @@
 export class SearchRequest {
   public expression: string;
   public timestamp: Date;
+  public enableSpellCheck: boolean;
 
-  constructor(expression: string, timestamp: Date) {
+  constructor(expression: string, timestamp: Date, enableSpellCheck: boolean) {
     this.expression = expression;
     this.timestamp = timestamp;
+    this.enableSpellCheck = enableSpellCheck;
   }
 }
diff --git a/fe/fulltextsearch/src/assets/i18n/cz-lang.json b/fe/fulltextsearch/src/assets/i18n/cz-lang.json
index 2487869..b23803e 100644
--- a/fe/fulltextsearch/src/assets/i18n/cz-lang.json
+++ b/fe/fulltextsearch/src/assets/i18n/cz-lang.json
@@ -12,7 +12,8 @@
   },
   "app-search-box": {
     "search": "Vyhledat",
-    "placeholder": "Zadejte text k vyhledání..."
+    "placeholder": "Zadejte text k vyhledání...",
+    "spell-check": "Zapnout automatickou kontrolu"
   },
   "app-search": {
     "expression": "Hledaný výraz: ",
diff --git a/fe/fulltextsearch/src/assets/i18n/de-lang.json b/fe/fulltextsearch/src/assets/i18n/de-lang.json
index c4cd055..ece65dd 100644
--- a/fe/fulltextsearch/src/assets/i18n/de-lang.json
+++ b/fe/fulltextsearch/src/assets/i18n/de-lang.json
@@ -12,7 +12,8 @@
   },
   "app-search-box": {
     "search": "Suchen",
-    "placeholder": "Geben Sie den Text ein..."
+    "placeholder": "Geben Sie den Text ein...",
+    "spell-check": "Ermöglichen autocorrect"
   },
   "app-search": {
     "expression": "Suchtext: ",
diff --git a/fe/fulltextsearch/src/assets/i18n/en-lang.json b/fe/fulltextsearch/src/assets/i18n/en-lang.json
index 697da0d..ca91b6e 100644
--- a/fe/fulltextsearch/src/assets/i18n/en-lang.json
+++ b/fe/fulltextsearch/src/assets/i18n/en-lang.json
@@ -12,7 +12,8 @@
   },
   "app-search-box": {
     "search": "Search",
-    "placeholder": "Enter text to search..."
+    "placeholder": "Enter text to search...",
+    "spell-check": "Enable autocorrect"
   },
   "app-search": {
     "expression": "Searching expression: ",
