diff --git a/src/app/app.component.html b/src/app/app.component.html
index 43aa0c7..6899d22 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -32,7 +32,7 @@
Send report
-
+ DEVELOPMENT
DeFinMa
diff --git a/src/app/sample/sample.component.html b/src/app/sample/sample.component.html
index aae27cd..c5b484a 100644
--- a/src/app/sample/sample.component.html
+++ b/src/app/sample/sample.component.html
@@ -19,16 +19,17 @@
Material properties
+ (focusout)="checkTypo($event, 'materialSuppliers', 'supplier', modalWarning)">
{{supplierInput.errors.failure}}
-
+ (focusout)="checkTypo($event, 'materialGroups', 'group', modalWarning)">
{{groupInput.errors.failure}}
diff --git a/src/app/sample/sample.component.ts b/src/app/sample/sample.component.ts
index d5a71b0..5168dff 100644
--- a/src/app/sample/sample.component.ts
+++ b/src/app/sample/sample.component.ts
@@ -434,8 +434,11 @@ export class SampleComponent implements OnInit, AfterContentChecked {
}
}
- checkTypo(list, mKey, modal: TemplateRef) {
- if (this.d.arr[list].indexOf(this.material[list]) < 0) { // entry is not in list
+ checkTypo(event, list, mKey, modal: TemplateRef) {
+ // user did not click on suggestion and entry is not in list
+ if (!(event.relatedTarget && (event.relatedTarget.className.indexOf('rb-dropdown-item') >= 0 ||
+ event.relatedTarget.className.indexOf('close-btn rb-btn rb-passive-link') >= 0)) &&
+ this.d.arr[list].indexOf(this.material[mKey]) < 0) {
this.modalText.list = mKey;
this.modalText.suggestion = this.d.arr[list] // find possible entry from list
.map(e => ({v: e, s: strCompare.sorensenDice(e, this.material[mKey])}))
diff --git a/src/app/services/validation.service.ts b/src/app/services/validation.service.ts
index 070e3a5..47134e2 100644
--- a/src/app/services/validation.service.ts
+++ b/src/app/services/validation.service.ts
@@ -122,6 +122,7 @@ export class ValidationService {
const {ignore, error} = Joi.string()
.max(128)
.invalid('condition_template', 'material_template')
+ .allow('')
.pattern(/^[^.]+$/)
.required()
.messages({'string.pattern.base': 'name must not contain a dot'})
diff --git a/src/app/templates/templates.component.html b/src/app/templates/templates.component.html
index 6d71ebc..7a6b46e 100644
--- a/src/app/templates/templates.component.html
+++ b/src/app/templates/templates.component.html
@@ -55,7 +55,8 @@
Edit template
-
+
Save template
diff --git a/src/app/templates/templates.component.ts b/src/app/templates/templates.component.ts
index f858665..5782be6 100644
--- a/src/app/templates/templates.component.ts
+++ b/src/app/templates/templates.component.ts
@@ -5,6 +5,7 @@ import {animate, style, transition, trigger} from '@angular/animations';
import {ValidationService} from '../services/validation.service';
import cloneDeep from 'lodash/cloneDeep';
import omit from 'lodash/omit';
+import {DataService} from '../services/data.service';
@Component({
selector: 'app-templates',
@@ -36,7 +37,8 @@ export class TemplatesComponent implements OnInit {
constructor(
private api: ApiService,
- private validate: ValidationService
+ private validate: ValidationService,
+ public d: DataService
) { }
ngOnInit(): void {
@@ -44,8 +46,8 @@ export class TemplatesComponent implements OnInit {
}
loadTemplates() {
- this.api.get(`/template/${this.collection}s`, data => {
- this.templates = data;
+ this.d.load(this.collection + 'Templates', () => {
+ this.templates = this.d.arr[this.collection + 'Templates'];
this.templateFormat();
});
}
@@ -99,6 +101,7 @@ export class TemplatesComponent implements OnInit {
this.templates.push(data);
}
this.templateFormat();
+ this.d.idReload(this.collection + 'Templates');
});
}
else {
@@ -107,6 +110,7 @@ export class TemplatesComponent implements OnInit {
this.templates.push(data);
}
this.templateFormat();
+ this.d.idReload(this.collection + 'Templates');
});
}
}