import {EventService} from '@eg/core/event.service';
import {OrgService} from '@eg/core/org.service';
import {AuthService} from '@eg/core/auth.service';
+import {StringComponent} from '@eg/share/string/string.component';
import {ToastService} from '@eg/share/toast/toast.service';
import {ComboboxComponent,
ComboboxEntry} from '@eg/share/combobox/combobox.component';
private fallThruMergeProfileSelector: ComboboxComponent;
@ViewChild('dupeQueueAlert', { static: true })
private dupeQueueAlert: AlertDialogComponent;
+ @ViewChild('loadMarcOrderTemplateSavedString', { static: false })
+ private loadMarcOrderTemplateSavedString: StringComponent;
+ @ViewChild('loadMarcOrderTemplateDeletedString', { static: false })
+ private loadMarcOrderTemplateDeletedString: StringComponent;
+ @ViewChild('loadMarcOrderTemplateSetAsDefaultString', { static: false })
+ private loadMarcOrderTemplateSetAsDefaultString: StringComponent;
+
constructor(
private http: HttpClient,
const template = {};
TEMPLATE_ATTRS.forEach(key => template[key] = this[key]);
- console.debug('Saving import profile', template);
-
this.formTemplates[this.selectedTemplate] = template;
- return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates);
+ this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x =>
+ this.loadMarcOrderTemplateSavedString.current()
+ .then(str => this.toast.success(str))
+ );
}
markTemplateDefault() {
Object.keys(this.formTemplates).forEach(
- name => delete this.formTemplates.default
+ name => delete this.formTemplates[name].default
);
this.formTemplates[this.selectedTemplate].default = true;
- return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates);
+ this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x =>
+ this.loadMarcOrderTemplateSetAsDefaultString.current()
+ .then(str => this.toast.success(str))
+ );
}
templateSelectorChange(entry: ComboboxEntry) {
deleteTemplate() {
delete this.formTemplates[this.selectedTemplate];
this.formTemplateSelector.selected = null;
- return this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates);
+ this.store.setItem(TEMPLATE_SETTING_NAME, this.formTemplates).then(x =>
+ this.loadMarcOrderTemplateDeletedString.current()
+ .then(str => this.toast.success(str))
+ );
}
}