| @@ -44,3 +44,6 @@ testem.log | |||
| # System Files | |||
| .DS_Store | |||
| Thumbs.db | |||
| # cache etc | |||
| /.angular | |||
| @@ -23,7 +23,7 @@ | |||
| "main": "src/main.ts", | |||
| "polyfills": "src/polyfills.ts", | |||
| "tsConfig": "tsconfig.app.json", | |||
| "aot": false, | |||
| "aot": true, | |||
| "assets": [ | |||
| "src/favicon.ico", | |||
| "src/assets" | |||
| @@ -11,30 +11,34 @@ | |||
| }, | |||
| "private": true, | |||
| "dependencies": { | |||
| "@angular-devkit/build-angular": "^16.0.0", | |||
| "@angular-devkit/schematics": "^16.0.0", | |||
| "@angular/common": "^12.2.17", | |||
| "@angular/compiler": "^12.2.17", | |||
| "@angular/core": "^12.2.17", | |||
| "@angular/forms": "^12.2.17", | |||
| "@angular/platform-browser": "^12.2.17", | |||
| "@angular/platform-browser-dynamic": "^12.2.17", | |||
| "@angular/router": "^12.2.17", | |||
| "@ng-bootstrap/ng-bootstrap": "^9.1.3", | |||
| "@angular/animations": "^16.0.0", | |||
| "@angular/common": "^16.0.0", | |||
| "@angular/compiler": "^16.0.0", | |||
| "@angular/core": "^16.0.0", | |||
| "@angular/forms": "^16.0.0", | |||
| "@angular/platform-browser": "^16.0.0", | |||
| "@angular/platform-browser-dynamic": "^16.0.0", | |||
| "@angular/router": "^16.0.0", | |||
| "@ng-bootstrap/ng-bootstrap": "^14.1.1", | |||
| "ag-grid-angular": "^21.2.2", | |||
| "ag-grid-community": "^21.2.2", | |||
| "angular-calendar": "^0.31.0", | |||
| "angularx-flatpickr": "^6.2.0", | |||
| "codelyzer": "^6.0.2", | |||
| "date-fns": "^1.30.1", | |||
| "file-saver": "^2.0.2", | |||
| "flatpickr": "^4.6.3", | |||
| "flatpickr": "^4.6.13", | |||
| "ng6-breadcrumbs": "^1.0.7", | |||
| "rxjs": "~6.6.7", | |||
| "tslib": "^2.0.0", | |||
| "zone.js": "~0.11.8" | |||
| "zone.js": "~0.13.0" | |||
| }, | |||
| "devDependencies": { | |||
| "@angular/cli": "^16.0.0", | |||
| "@angular/compiler-cli": "^12.2.17", | |||
| "@angular/language-service": "^12.2.17", | |||
| "@angular/compiler-cli": "^16.0.0", | |||
| "@angular/language-service": "^16.0.0", | |||
| "@types/file-saver": "^2.0.1", | |||
| "@types/jasmine": "~3.3.8", | |||
| "@types/jasminewd2": "^2.0.8", | |||
| @@ -46,9 +50,9 @@ | |||
| "karma-coverage-istanbul-reporter": "~3.0.2", | |||
| "karma-jasmine": "~4.0.0", | |||
| "karma-jasmine-html-reporter": "^1.5.0", | |||
| "protractor": "^3.3.0", | |||
| "protractor": "^7.0.0", | |||
| "ts-node": "~7.0.0", | |||
| "tslint": "~6.1.0", | |||
| "typescript": "~4.3.5" | |||
| "typescript": "~4.9.5" | |||
| } | |||
| } | |||
| } | |||
| @@ -64,94 +64,9 @@ import { CustomerContactPersonDetailComponent } from './views/customer-managemen | |||
| import {MeetingService} from './services/meeting.service'; | |||
| import { InternalMeetingEditComponent } from './views/start/internal-meeting-edit/internal-meeting-edit.component'; | |||
| import { InternalMeetingDetailComponent } from './views/start/internal-meeting-detail/internal-meeting-detail.component'; | |||
| import {OperatorService} from './services/operator.service'; | |||
| import { OperatorsComponent } from './views/operators/operators.component'; | |||
| import { OperatorsContactListComponent } from './views/operators/operators-contact-list/operators-contact-list.component'; | |||
| import { OperatorsListComponent } from './views/operators/operators-list/operators-list.component'; | |||
| import { OperatorViewComponent } from './views/operators/operator-view/operator-view.component'; | |||
| import { OperatorContactPersonViewComponent } from './views/operators/operator-view/operator-contact-person-view/operator-contact-person-view.component'; | |||
| import { OperatorContactPersonEditComponent } from './views/operators/operator-view/operator-contact-person-edit/operator-contact-person-edit.component'; | |||
| import { OperatorContactPersonDetailComponent } from './views/operators/operator-view/operator-contact-person-detail/operator-contact-person-detail.component'; | |||
| import { OperatorDataEditComponent } from './views/operators/operator-view/operator-data-edit/operator-data-edit.component'; | |||
| import { OperatorDataViewComponent } from './views/operators/operator-view/operator-data-view/operator-data-view.component'; | |||
| import { OperatorNoteDetailComponent } from './views/operators/operator-view/operator-note-detail/operator-note-detail.component'; | |||
| import { OperatorNoteViewComponent } from './views/operators/operator-view/operator-note-view/operator-note-view.component'; | |||
| import { OperatorNoteEditComponent } from './views/operators/operator-view/operator-note-edit/operator-note-edit.component'; | |||
| import { OperatorMeetingViewComponent } from './views/operators/operator-view/operator-meeting-view/operator-meeting-view.component'; | |||
| import { OperatorMeetingEditComponent } from './views/operators/operator-view/operator-meeting-edit/operator-meeting-edit.component'; | |||
| import { OperatorMeetingDetailComponent } from './views/operators/operator-view/operator-meeting-detail/operator-meeting-detail.component'; | |||
| import { CalendarLegendComponent } from './components/calendar-legend/calendar-legend.component'; | |||
| import { CommonService } from './services/common.service'; | |||
| import { | |||
| ProductionsContactListComponent | |||
| } from './views/productions/productions-contact-list/productions-contact-list.component'; | |||
| import {ProductionsListComponent} from './views/productions/productions-list/productions-list.component'; | |||
| import {ProductionViewComponent} from './views/productions/production-view/production-view.component'; | |||
| import { | |||
| ProductionContactPersonViewComponent | |||
| } from './views/productions/production-view/production-contact-person-view/production-contact-person-view.component'; | |||
| import { | |||
| ProductionContactPersonEditComponent | |||
| } from './views/productions/production-view/production-contact-person-edit/production-contact-person-edit.component'; | |||
| import { | |||
| ProductionContactPersonDetailComponent | |||
| } from './views/productions/production-view/production-contact-person-detail/production-contact-person-detail.component'; | |||
| import { | |||
| ProductionDataEditComponent | |||
| } from './views/productions/production-view/production-data-edit/production-data-edit.component'; | |||
| import { | |||
| ProductionDataViewComponent | |||
| } from './views/productions/production-view/production-data-view/production-data-view.component'; | |||
| import { | |||
| ProductionNoteDetailComponent | |||
| } from './views/productions/production-view/production-note-detail/production-note-detail.component'; | |||
| import { | |||
| ProductionNoteViewComponent | |||
| } from './views/productions/production-view/production-note-view/production-note-view.component'; | |||
| import { | |||
| ProductionNoteEditComponent | |||
| } from './views/productions/production-view/production-note-edit/production-note-edit.component'; | |||
| import { | |||
| ProductionMeetingViewComponent | |||
| } from './views/productions/production-view/production-meeting-view/production-meeting-view.component'; | |||
| import { | |||
| ProductionMeetingEditComponent | |||
| } from './views/productions/production-view/production-meeting-edit/production-meeting-edit.component'; | |||
| import { | |||
| ProductionMeetingDetailComponent | |||
| } from './views/productions/production-view/production-meeting-detail/production-meeting-detail.component'; | |||
| import {ProductionService} from './services/production.service'; | |||
| import {ServiceService} from './services/service.service'; | |||
| import {ProductionsComponent} from './views/productions/productions.component'; | |||
| import {ServicesContactListComponent} from './views/services/services-contact-list/services-contact-list.component'; | |||
| import {ServicesListComponent} from './views/services/services-list/services-list.component'; | |||
| import {ServiceViewComponent} from './views/services/service-view/service-view.component'; | |||
| import { | |||
| ServiceContactPersonViewComponent | |||
| } from './views/services/service-view/service-contact-person-view/service-contact-person-view.component'; | |||
| import { | |||
| ServiceContactPersonEditComponent | |||
| } from './views/services/service-view/service-contact-person-edit/service-contact-person-edit.component'; | |||
| import { | |||
| ServiceContactPersonDetailComponent | |||
| } from './views/services/service-view/service-contact-person-detail/service-contact-person-detail.component'; | |||
| import {ServiceDataEditComponent} from './views/services/service-view/service-data-edit/service-data-edit.component'; | |||
| import {ServiceDataViewComponent} from './views/services/service-view/service-data-view/service-data-view.component'; | |||
| import { | |||
| ServiceNoteDetailComponent | |||
| } from './views/services/service-view/service-note-detail/service-note-detail.component'; | |||
| import {ServiceNoteViewComponent} from './views/services/service-view/service-note-view/service-note-view.component'; | |||
| import {ServiceNoteEditComponent} from './views/services/service-view/service-note-edit/service-note-edit.component'; | |||
| import { | |||
| ServiceMeetingViewComponent | |||
| } from './views/services/service-view/service-meeting-view/service-meeting-view.component'; | |||
| import { | |||
| ServiceMeetingEditComponent | |||
| } from './views/services/service-view/service-meeting-edit/service-meeting-edit.component'; | |||
| import { | |||
| ServiceMeetingDetailComponent | |||
| } from './views/services/service-view/service-meeting-detail/service-meeting-detail.component'; | |||
| import {ServicesComponent} from './views/services/services.component'; | |||
| registerLocaleData(localeDe); | |||
| @@ -164,7 +79,6 @@ registerLocaleData(localeDe); | |||
| LoginComponent, | |||
| AsideComponent, | |||
| TechniqueComponent, | |||
| ProductionsComponent, | |||
| SalesComponent, | |||
| AccountingComponent, | |||
| ModalComponent, | |||
| @@ -201,51 +115,6 @@ registerLocaleData(localeDe); | |||
| CustomerContactPersonDetailComponent, | |||
| InternalMeetingEditComponent, | |||
| InternalMeetingDetailComponent, | |||
| OperatorsComponent, | |||
| OperatorsContactListComponent, | |||
| OperatorsListComponent, | |||
| OperatorViewComponent, | |||
| OperatorContactPersonViewComponent, | |||
| OperatorContactPersonEditComponent, | |||
| OperatorContactPersonDetailComponent, | |||
| OperatorDataEditComponent, | |||
| OperatorDataViewComponent, | |||
| OperatorNoteDetailComponent, | |||
| OperatorNoteViewComponent, | |||
| OperatorNoteEditComponent, | |||
| OperatorMeetingViewComponent, | |||
| OperatorMeetingEditComponent, | |||
| OperatorMeetingDetailComponent, | |||
| ProductionsComponent, | |||
| ProductionsContactListComponent, | |||
| ProductionsListComponent, | |||
| ProductionViewComponent, | |||
| ProductionContactPersonViewComponent, | |||
| ProductionContactPersonEditComponent, | |||
| ProductionContactPersonDetailComponent, | |||
| ProductionDataEditComponent, | |||
| ProductionDataViewComponent, | |||
| ProductionNoteDetailComponent, | |||
| ProductionNoteViewComponent, | |||
| ProductionNoteEditComponent, | |||
| ProductionMeetingViewComponent, | |||
| ProductionMeetingEditComponent, | |||
| ProductionMeetingDetailComponent, | |||
| ServicesComponent, | |||
| ServicesContactListComponent, | |||
| ServicesListComponent, | |||
| ServiceViewComponent, | |||
| ServiceContactPersonViewComponent, | |||
| ServiceContactPersonEditComponent, | |||
| ServiceContactPersonDetailComponent, | |||
| ServiceDataEditComponent, | |||
| ServiceDataViewComponent, | |||
| ServiceNoteDetailComponent, | |||
| ServiceNoteViewComponent, | |||
| ServiceNoteEditComponent, | |||
| ServiceMeetingViewComponent, | |||
| ServiceMeetingEditComponent, | |||
| ServiceMeetingDetailComponent, | |||
| CalendarLegendComponent, | |||
| ], | |||
| imports: [ | |||
| @@ -279,10 +148,7 @@ registerLocaleData(localeDe); | |||
| CacheService, | |||
| MessageService, | |||
| HttpService, | |||
| CustomerService, | |||
| OperatorService, | |||
| ProductionService, | |||
| ServiceService, | |||
| CustomerService | |||
| MeetingService, | |||
| CommonService, | |||
| {provide: HTTP_INTERCEPTORS, useClass: HttpClientInterceptor, multi: true}, | |||
| @@ -1,5 +1,4 @@ | |||
| import {GridFactory} from '../grid-cellrenderer/grid-factory'; | |||
| import {isNull} from 'util'; | |||
| import {IGridCellParams} from '../grid-cellrenderer/grid-cell-params'; | |||
| import {Const} from '../utils/const'; | |||
| @@ -62,12 +61,11 @@ export class AgGridComponentConst { | |||
| /** | |||
| * Sets input error | |||
| * @param {string} errorMessage | |||
| */ | |||
| public static setGridInputError(errorMessage: string = null): void { | |||
| AgGridComponentConst.gridInputError = errorMessage; | |||
| if (!isNull(errorMessage)) { | |||
| setTimeout(function() { | |||
| if (null !== errorMessage) { | |||
| setTimeout(() => { | |||
| AgGridComponentConst.setGridInputError(); | |||
| }, 10); | |||
| } | |||
| @@ -75,12 +73,9 @@ export class AgGridComponentConst { | |||
| /** | |||
| * Returns a cell renderer for given type with given parameters | |||
| * @param params | |||
| * @param {IGridCellParams} gridCellParams | |||
| * @returns {{}} | |||
| */ | |||
| public static cellRendererSelector(params: any, gridCellParams: IGridCellParams = null): {} { | |||
| if (isNull(gridCellParams)) { | |||
| if (null === gridCellParams) { | |||
| gridCellParams = GridFactory.getGridCellParams(); | |||
| } | |||
| @@ -109,12 +104,9 @@ export class AgGridComponentConst { | |||
| /** | |||
| * Returns a cell editor for given type with given parameters | |||
| * @param params | |||
| * @param {IGridCellParams} gridCellParams | |||
| * @returns {{component: string; params: IGridCellParams}} | |||
| */ | |||
| public static cellEditorSelector(params: any, gridCellParams: IGridCellParams = null) { | |||
| if (isNull(gridCellParams)) { | |||
| if (null === gridCellParams) { | |||
| gridCellParams = GridFactory.getGridCellParams(); | |||
| } | |||
| @@ -148,7 +140,7 @@ export class AgGridComponentConst { | |||
| * @param {string} type | |||
| */ | |||
| private static checkCellValueType(type: string = null): void { | |||
| if (!isNull(type) && AgGridComponentConst.validCellValueTypes.indexOf(type) < 0) { | |||
| if (null !== type && AgGridComponentConst.validCellValueTypes.indexOf(type) < 0) { | |||
| throw new Error('Unknown cell value type'); | |||
| } | |||
| } | |||
| @@ -158,7 +150,7 @@ export class AgGridComponentConst { | |||
| * @param {string} type | |||
| */ | |||
| private static checkCellUnit(type: string = null): void { | |||
| if (!isNull(type) && AgGridComponentConst.validCellUnits.indexOf(type) < 0) { | |||
| if (null !== type && AgGridComponentConst.validCellUnits.indexOf(type) < 0) { | |||
| throw new Error('Unknown cell value type'); | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| import {isNull, isUndefined} from 'util'; | |||
| import {isUndefined} from 'util'; | |||
| import {path} from '../../environments/path'; | |||
| import {AgGridLocale} from '../lang/ag-gridlocale'; | |||
| import {IGridValidationErrors} from '../model/virtual/grid-validation-errors'; | |||
| @@ -39,7 +39,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Constructor | |||
| * @param {boolean} bSizeColumnsToFit | |||
| */ | |||
| constructor(bSizeColumnsToFit: boolean = true) { | |||
| AgGridComponentConst.setGridInputError(); | |||
| @@ -77,7 +76,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Callback on grid ready | |||
| * @param params | |||
| */ | |||
| public onGridReady(params): void { | |||
| this.params = params; | |||
| @@ -87,7 +85,7 @@ export class AgGridComponent { | |||
| // Set for cadasters | |||
| if (!this.bSizeColumnsToFit) { | |||
| const allColumnIds = []; | |||
| this.gridParamsColumnApi.getAllColumns().forEach(function(column) { | |||
| this.gridParamsColumnApi.getAllColumns().forEach((column) => { | |||
| allColumnIds.push(column.colId); | |||
| }); | |||
| this.gridParamsColumnApi.autoSizeColumns(allColumnIds); | |||
| @@ -96,7 +94,6 @@ export class AgGridComponent { | |||
| /** | |||
| * On row clicked | |||
| * @param e | |||
| */ | |||
| public onRowClicked(e): void { | |||
| // Reset error message | |||
| @@ -109,7 +106,7 @@ export class AgGridComponent { | |||
| * @param e | |||
| */ | |||
| public onCellEditingStopped(e): void { | |||
| if (!isNull(AgGridComponentConst.gridInputError)) { | |||
| if (null !== AgGridComponentConst.gridInputError) { | |||
| this.errorMessage = AgGridComponentConst.gridInputError; | |||
| e.api.ensureIndexVisible(e.rowIndex, 'middle'); | |||
| e.api.ensureColumnVisible(e.colDef.field.toString()); | |||
| @@ -131,7 +128,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Resizes grid | |||
| * @param params | |||
| */ | |||
| public gridSizeChanged(params: any): void { | |||
| if (!isUndefined(this.gridParamsApi)) { | |||
| @@ -141,10 +137,9 @@ export class AgGridComponent { | |||
| /** | |||
| * Search Form | |||
| * @param params | |||
| */ | |||
| public searchFormSubmit(params: any): void { | |||
| if (params.target.value != '') { | |||
| if (params.target.value !== '') { | |||
| this.resetSearchBtn = true; | |||
| this.gridParamsApi.setQuickFilter(params.target.value); | |||
| } else { | |||
| @@ -155,7 +150,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Reset search input | |||
| * @param e | |||
| */ | |||
| public resetSearch(e: any): void { | |||
| e.originalTarget[0].value = ''; | |||
| @@ -172,12 +166,10 @@ export class AgGridComponent { | |||
| /** | |||
| * Configures scrollToService - https://www.npmjs.com/package/@nicky-lenaers/ngx-scroll-to | |||
| * @param {string} targetFieldName | |||
| * @param {string} lastFieldName | |||
| */ | |||
| public scrollTo(targetFieldName: string = null, lastFieldName: string = null): void { | |||
| if (!isNull(targetFieldName)) { | |||
| if (!isNull(lastFieldName)) { | |||
| if (null !== targetFieldName) { | |||
| if (null !== lastFieldName) { | |||
| // Scroll to last field first to ensure our target field name is on left-hand side | |||
| this.params.api.ensureColumnVisible(lastFieldName); | |||
| } | |||
| @@ -187,7 +179,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Cell renderer selector for individual cells with optional default parameters | |||
| * @param params | |||
| */ | |||
| public cellRendererSelector(params: any): {} { | |||
| return AgGridComponentConst.cellRendererSelector(params); | |||
| @@ -195,7 +186,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Cell editor selector for individual cells | |||
| * @param params | |||
| */ | |||
| public cellEditorSelector(params: any): {} { | |||
| return AgGridComponentConst.cellEditorSelector(params); | |||
| @@ -213,50 +203,48 @@ export class AgGridComponent { | |||
| const errorColumn: any[] = []; | |||
| const errors: IGridValidationErrors[] = []; | |||
| for (let k = 0; k < primaryColumns.length; k++) { | |||
| if (!isUndefined(primaryColumns[k].colDef.cellEditorParams)) { | |||
| if (!isUndefined(primaryColumns[k].colDef.cellEditorParams.mandatory) && primaryColumns[k].colDef.cellEditorParams.mandatory == true) { | |||
| errorColumn.push(primaryColumns[k].colDef.field); | |||
| primaryColumns.forEach((value) => { | |||
| if (!isUndefined(value.colDef.cellEditorParams)) { | |||
| if (!isUndefined(value.colDef.cellEditorParams.mandatory) && value.colDef.cellEditorParams.mandatory === true) { | |||
| errorColumn.push(value.colDef.field); | |||
| } | |||
| } | |||
| } | |||
| }); | |||
| for (let m = 0; m < errorColumn.length; m++) { | |||
| this.params.api.forEachNode(function(rowNode, index) { | |||
| if (isNull(rowNode.data[errorColumn[m]]) || isUndefined(rowNode.data[errorColumn[m]])) { | |||
| errorColumn.forEach((value, i) => { | |||
| this.params.api.forEachNode((rowNode, index) => { | |||
| if (null === rowNode.data[value] || isUndefined(rowNode.data[value])) { | |||
| errors.push({ | |||
| column: errorColumn[m], | |||
| column: value, | |||
| row: index | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| }); | |||
| this.gridErrors = errors; | |||
| if (this.gridErrors.length != 0) { | |||
| if (oldErrors.length != this.gridErrors.length) { | |||
| if (this.gridErrors.length !== 0) { | |||
| if (oldErrors.length !== this.gridErrors.length) { | |||
| this.params.api.ensureIndexVisible(this.gridErrors[0].row, 'middle'); | |||
| this.params.api.ensureColumnVisible(this.gridErrors[0].column); | |||
| } | |||
| } | |||
| return this.gridErrors.length == 0; | |||
| return this.gridErrors.length === 0; | |||
| } | |||
| /** | |||
| * Jumps to error | |||
| * @param direction | |||
| */ | |||
| public jumpToError(direction: string): void { | |||
| const errorLength: number = this.gridErrors.length - 1; | |||
| // If any errors | |||
| if (errorLength >= 0) { | |||
| // if errorIndex is smaller or same as list of all errors | |||
| if (errorLength == 0) { | |||
| if (errorLength === 0) { | |||
| this.errorIndex = 0; | |||
| } else { | |||
| if (direction == 'next') { | |||
| if (direction === 'next') { | |||
| this.errorIndex = this.errorIndex < errorLength ? this.errorIndex + 1 : 0; | |||
| } else { | |||
| this.errorIndex = this.errorIndex <= 0 ? errorLength : this.errorIndex - 1; | |||
| @@ -272,10 +260,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Shows input error | |||
| * @param {number} positionIndex | |||
| * @param {string} field | |||
| * @param {string} oldValue | |||
| * @param {string} type | |||
| */ | |||
| public showInputError(positionIndex: number, field: string, oldValue: string, type: string): void { | |||
| this.resetValueByError = true; | |||
| @@ -303,20 +287,19 @@ export class AgGridComponent { | |||
| /** | |||
| * Add row to grid and returns position index | |||
| * @param item | |||
| */ | |||
| public addRow(item: {}): number { | |||
| this.initNextAddedItemId(); | |||
| const rowModel = this.gridParamsApi.rowModel; | |||
| // Note: default is last row | |||
| let addIndex: number = rowModel.rowsToDisplay.length + 1; | |||
| for (let i = 0; i < rowModel.rowsToDisplay.length; i++) { | |||
| if (rowModel.rowsToDisplay[i].selected == true) { | |||
| rowModel.rowsToDisplay.forEach((row, i) => { | |||
| if (row.selected === true) { | |||
| // Note: Add index is the row after selected row | |||
| addIndex = i + 1; | |||
| break; | |||
| return; | |||
| } | |||
| } | |||
| }); | |||
| this.gridParamsApi.updateRowData({ | |||
| add: [item], | |||
| addIndex | |||
| @@ -351,7 +334,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Returns dummy id for added entry | |||
| * @returns {number} | |||
| */ | |||
| public getNextAddedItemId(): number { | |||
| this.initNextAddedItemId(); | |||
| @@ -362,7 +344,6 @@ export class AgGridComponent { | |||
| /** | |||
| * column resize event | |||
| * @param event | |||
| */ | |||
| public onColumnResized(event): void { | |||
| if (event.finished !== false) { | |||
| @@ -383,7 +364,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Renders colored dot | |||
| * @param params | |||
| */ | |||
| public dotRenderer(params): string { | |||
| return '<span class=\'dot dot--' + params.value + '\'></span>'; | |||
| @@ -391,31 +371,27 @@ export class AgGridComponent { | |||
| /** | |||
| * Renders email address | |||
| * @param params | |||
| */ | |||
| public emailRenderer(params): string { | |||
| return !isNull(params.value) ? '<a href=\'mailto:' + params.value + '\'>' + params.value + '</a>' : ''; | |||
| return null !== params.value ? '<a href=\'mailto:' + params.value + '\'>' + params.value + '</a>' : ''; | |||
| } | |||
| /** | |||
| * Renders phone number | |||
| * @param params | |||
| */ | |||
| public phoneRenderer(params): string { | |||
| return !isNull(params.value) ? '<a href=\'tel:' + params.value + '\'>' + params.value + '</a>' : ''; | |||
| return null !== params.value ? '<a href=\'tel:' + params.value + '\'>' + params.value + '</a>' : ''; | |||
| } | |||
| /** | |||
| * Renders phone number | |||
| * @param params | |||
| */ | |||
| public urlRenderer(params): string { | |||
| return !isNull(params.value) ? '<a href=\'' + Utils.checkUrl(params.value) + '\' target=\'_blank\'>' + params.value + '</a>' : ''; | |||
| return null !== params.value ? '<a href=\'' + Utils.checkUrl(params.value) + '\' target=\'_blank\'>' + params.value + '</a>' : ''; | |||
| } | |||
| /** | |||
| * option renderer | |||
| * @param params | |||
| */ | |||
| public optionRenderer(params): string { | |||
| return params.data.is_option_meeting ? 'Ja' : ''; | |||
| @@ -423,7 +399,6 @@ export class AgGridComponent { | |||
| /** | |||
| * address renderer | |||
| * @param params | |||
| */ | |||
| public addressRenderer(params): string { | |||
| let address = ''; | |||
| @@ -443,20 +418,18 @@ export class AgGridComponent { | |||
| /** | |||
| * participants renderer | |||
| * @param params | |||
| */ | |||
| public participantsRenderer(params): string { | |||
| let participantNames = ''; | |||
| for (let i = 0; i < params.data.participants.length; i++) { | |||
| participantNames += params.data.that.appService.getConfig().vc_user_by_id[params.data.participants[i].participant_user_id].firstname + | |||
| ' ' + params.data.that.appService.getConfig().vc_user_by_id[params.data.participants[i].participant_user_id].lastname + '<br />'; | |||
| } | |||
| params.data.participants.forEach((value) => { | |||
| participantNames += params.data.that.appService.getConfig().vc_user_by_id[value.participant_user_id].firstname + | |||
| ' ' + params.data.that.appService.getConfig().vc_user_by_id[value.participant_user_id].lastname + '<br />'; | |||
| }); | |||
| return participantNames; | |||
| } | |||
| /** | |||
| * Time renderer | |||
| * @param params | |||
| */ | |||
| public timeRenderer(params): string { | |||
| return Utils.getDateTimeToDisplay(params.value, false, true); | |||
| @@ -464,7 +437,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Date renderer | |||
| * @param params | |||
| */ | |||
| public dateRenderer(params): string { | |||
| return Utils.getDateTimeToDisplay(params.value); | |||
| @@ -472,7 +444,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Datetime renderer | |||
| * @param params | |||
| */ | |||
| public dateTimeRenderer(params): string { | |||
| return Utils.getDateTimeToDisplay(params.value, true, true); | |||
| @@ -480,9 +451,6 @@ export class AgGridComponent { | |||
| /** | |||
| * Date comparator | |||
| * @param date1 | |||
| * @param date2 | |||
| * @param callbackCheck | |||
| */ | |||
| public dateComparator(date1, date2, callbackCheck: boolean = true) { | |||
| if (date1 === null && date2 === null) { | |||
| @@ -496,6 +464,6 @@ export class AgGridComponent { | |||
| } | |||
| const stamp1: number = Utils.getParsedDate(date1); | |||
| const stamp2: number = Utils.getParsedDate(date2); | |||
| return stamp1 < stamp2 ? 1 : stamp1 == stamp2 ? 0 : -1; | |||
| return stamp1 < stamp2 ? 1 : stamp1 === stamp2 ? 0 : -1; | |||
| } | |||
| } | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component, OnDestroy, OnInit} from '@angular/core'; | |||
| import {MessageService} from '../../services/message.service'; | |||
| import {Subscription} from 'rxjs'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-message', | |||
| @@ -76,7 +75,7 @@ export class MessageComponent implements OnInit, OnDestroy { | |||
| this.showClientError = false; | |||
| this.message = errorMsg; | |||
| // Set optional info (if exists) | |||
| this.optionalInfo = !isNull(optionalInfo) ? optionalInfo : null; | |||
| this.optionalInfo = null !== optionalInfo ? optionalInfo : null; | |||
| } | |||
| /** | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {GridEditorComponent} from '../../grid-editor-component'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-grid-checkbox-editor', | |||
| @@ -19,7 +18,7 @@ export class GridCheckboxEditorComponent extends GridEditorComponent { | |||
| super.agInit(params); | |||
| // Set true to false, because of single click | |||
| this.value = isNull(this.value) ? true : !this.value; | |||
| this.value = null === this.value ? true : !this.value; | |||
| if (!Utils.isBoolean(this.value)) { | |||
| throw new Error('checkbox requires boolean value'); | |||
| } | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-grid-checkbox-renderer', | |||
| @@ -16,7 +15,7 @@ export class GridCheckboxRendererComponent extends GridRendererComponent { | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| this.value = isNull(this.value) ? false : this.value; | |||
| this.value = null === this.value ? false : this.value; | |||
| if (!Utils.isBoolean(this.value)) { | |||
| throw new Error('checkbox requires boolean value'); | |||
| } | |||
| @@ -1,5 +1,5 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {isNull, isUndefined} from 'util'; | |||
| import {isUndefined} from 'util'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| @Component({ | |||
| @@ -19,7 +19,7 @@ export class GridDateRendererComponent extends GridRendererComponent { | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| let tempValue: string[] = []; | |||
| if (isNull(this.value) || isUndefined(this.value)) { | |||
| if (null === this.value || isUndefined(this.value)) { | |||
| this.displayedValue = ''; | |||
| } else { | |||
| tempValue = this.value.split('-'); | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {GridEditorComponent} from '../../grid-editor-component'; | |||
| import {AgGridComponentConst} from '../../../components/ag-grid-component-const'; | |||
| import {isNull} from 'util'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| @Component({ | |||
| @@ -18,9 +17,9 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| if (this.cellParams != undefined && this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| if (this.cellParams !== undefined && this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| // Replace "." with "," for display purpose | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : parseFloat(this.value).toFixed(2).replace('.', ','); | |||
| this.value = isNaN(this.value) || null === this.value ? '' : parseFloat(this.value).toFixed(2).replace('.', ','); | |||
| } | |||
| } | |||
| @@ -28,10 +27,10 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| * Returns value to cell renderer | |||
| */ | |||
| getValue(): any { | |||
| if (this.cellParams != undefined && this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| if (this.cellParams !== undefined && this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| // Replace "." with "," for display purpose and cast back to number | |||
| this.value = this.value.replace(',', '.'); | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : Number(parseFloat(this.value).toFixed(2)); | |||
| this.value = isNaN(this.value) || null === this.value ? '' : Number(parseFloat(this.value).toFixed(2)); | |||
| } | |||
| return this.value; | |||
| } | |||
| @@ -41,7 +40,7 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| * @returns {boolean} | |||
| */ | |||
| isCancelAfterEnd(): boolean { | |||
| if (this.cellParams.mandatory && (isNull(this.value) || this.value.toString().trim() == '')) { | |||
| if (this.cellParams.mandatory && (null === this.value || this.value.toString().trim() === '')) { | |||
| // Null value or empty string | |||
| AgGridComponentConst.setGridInputError(this.GRID_ERROR_EMPTY); | |||
| return true; | |||
| @@ -62,10 +61,10 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_INT || | |||
| this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| const numericVal: number = Number(String(this.value).replace(',', '.')); | |||
| if (!isNull(this.cellParams.min) && numericVal < Number(this.cellParams.min)) { | |||
| if (null !== this.cellParams.min && numericVal < Number(this.cellParams.min)) { | |||
| // Check on alternative value | |||
| if (!isNull(this.cellParams.altVal)) { | |||
| if (numericVal == this.cellParams.altVal) { | |||
| if (null !== this.cellParams.altVal) { | |||
| if (numericVal === this.cellParams.altVal) { | |||
| // Alternative value (to min and max) -> no error | |||
| return false; | |||
| } else { | |||
| @@ -79,10 +78,10 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| return true; | |||
| } | |||
| } | |||
| if (!isNull(this.cellParams.max) && numericVal > Number(this.cellParams.max)) { | |||
| if (null !== this.cellParams.max && numericVal > Number(this.cellParams.max)) { | |||
| // Check on alternative value | |||
| if (!isNull(this.cellParams.altVal)) { | |||
| if (numericVal == this.cellParams.altVal) { | |||
| if (null !== this.cellParams.altVal) { | |||
| if (numericVal === this.cellParams.altVal) { | |||
| // Alternative value (to min and max) -> no error | |||
| return false; | |||
| } else { | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| import {AgGridComponentConst} from '../../../components/ag-grid-component-const'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-grid-input-renderer', | |||
| @@ -16,13 +15,13 @@ export class GridInputRendererComponent extends GridRendererComponent { | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| if (this.cellParams != undefined) { | |||
| if (this.cellParams !== undefined) { | |||
| // Replace "." with "," for display purpose | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : parseFloat(parseFloat(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| if (this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| this.value = isNaN(this.value) || null === this.value ? '' : parseFloat(parseFloat(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| } | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_INT) { | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : parseInt(parseInt(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| if (this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_INT) { | |||
| this.value = isNaN(this.value) || null === this.value ? '' : parseInt(parseInt(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,9 +1,9 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {IGridSelectItem} from '../grid-select-item'; | |||
| import {isNull, isUndefined} from 'util'; | |||
| import {isUndefined} from 'util'; | |||
| import {GridEditorComponent} from '../../grid-editor-component'; | |||
| import {GridSelectFactory} from '../grid-select-factory'; | |||
| import {IGridCellEditorParams} from "../../grid-cell-editor-params"; | |||
| import {IGridCellEditorParams} from '../../grid-cell-editor-params'; | |||
| @Component({ | |||
| selector: 'app-grid-select-editor', | |||
| @@ -22,7 +22,6 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Initialize select editor (called after double-click) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| @@ -32,17 +31,16 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| this.itemKey = cellEditorParams.itemKey; | |||
| this.itemValueKeys = cellEditorParams.itemValueKeys; | |||
| const relatedValue: string | null = cellEditorParams.relatesOnDgField; | |||
| if (!isNull(cellEditorParams.relatesOnDgField)) { | |||
| // Get values by related dg field | |||
| const relatedValue: string = cellEditorParams.relatesOnDgField; | |||
| const itemRange: any[] = params.node.data.hasOwnProperty(relatedValue) && !isNull(params.node.data[relatedValue]) ? | |||
| if (null !== relatedValue) { | |||
| const itemRange: any[] = (params.node.data.hasOwnProperty(relatedValue) && null !== params.node.data[relatedValue]) ? | |||
| cellEditorParams.values[params.node.data[relatedValue]] : null; | |||
| if (!isNull(itemRange) && !isUndefined(itemRange)) { | |||
| for (let i = 0; i < itemRange.length; i++) { | |||
| this.values.push(GridSelectFactory.getGridSelectItem(itemRange[i], this.itemKey, this.itemValueKeys)); | |||
| } | |||
| if (null !== itemRange && !isUndefined(itemRange)) { | |||
| itemRange.forEach(item => { | |||
| this.values.push(GridSelectFactory.getGridSelectItem(item, this.itemKey, this.itemValueKeys)); | |||
| }); | |||
| } | |||
| } else if (cellEditorParams.exclusive === true) { | |||
| @@ -71,7 +69,7 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| * Returns value to cell renderer | |||
| */ | |||
| getValue(): any { | |||
| return isNull(this.newValue) ? null : this.newValue.key; | |||
| return null === this.newValue ?? this.newValue.key; | |||
| } | |||
| /** | |||
| @@ -1,5 +1,4 @@ | |||
| import {Const} from '../../utils/const'; | |||
| import {isNull} from 'util'; | |||
| import {IGridSelectItem} from './grid-select-item'; | |||
| @@ -26,7 +25,7 @@ export class GridSelectFactory { | |||
| headerClass: string = null, pinned: boolean = false, cellClass: any = null, | |||
| exclusive: boolean = false, exclusiveCompareData: any = null, exclusiveCompareDataKey: string = null): {} { | |||
| if (!isNull(relatesOnDgField) && exclusive) { | |||
| if (null !== relatesOnDgField && exclusive) { | |||
| // NOTE: This is not allowed for now, maybe needed in future | |||
| throw new Error('Select can be either relative or exclusive'); | |||
| } | |||
| @@ -37,11 +36,11 @@ export class GridSelectFactory { | |||
| headerClass, | |||
| pinned, | |||
| editable, | |||
| cellClass: isNull(cellClass) ? (editable ? '' : Const.CSS_NO_EDIT) : cellClass, | |||
| cellClass: null === cellClass ?? (editable ? '' : Const.CSS_NO_EDIT), | |||
| cellRenderer: 'gridSelectRenderer', | |||
| cellEditor: 'gridSelectEditor', | |||
| cellEditorParams: { | |||
| values: isNull(relatesOnDgField) && !exclusive ? GridSelectFactory.getGridSelectItems(values, itemKey, itemValueKeys, mandatory) : values, | |||
| values: null === relatesOnDgField && !exclusive ? GridSelectFactory.getGridSelectItems(values, itemKey, itemValueKeys, mandatory) : values, | |||
| itemKey, | |||
| itemValueKeys, | |||
| mandatory, | |||
| @@ -52,7 +51,7 @@ export class GridSelectFactory { | |||
| } | |||
| }; | |||
| if (mandatory) { | |||
| res['cellClassRules'] = { | |||
| res.cellClassRules = { | |||
| error(params) { | |||
| return params.value == null; | |||
| } | |||
| @@ -87,8 +86,8 @@ export class GridSelectFactory { | |||
| headerName, field, editable, values, itemKey, itemValueKeys, mandatory, relatesOnDgField, | |||
| headerClass, pinned, cellClass, exclusive, exclusiveCompareData, exclusiveCompareDataKey | |||
| ); | |||
| delete res['cellRenderer']; | |||
| delete res['cellEditor']; | |||
| delete res.cellRenderer; | |||
| delete res.cellEditor; | |||
| return res; | |||
| } | |||
| @@ -107,18 +106,14 @@ export class GridSelectFactory { | |||
| res.push(GridSelectFactory.getGridSelectItem({key: null, value: '-'}, 'key', valueKeys, true)); | |||
| } | |||
| for (let i = 0; i < objArray.length; i++) { | |||
| res.push(GridSelectFactory.getGridSelectItem(objArray[i], key, valueKeys)); | |||
| } | |||
| objArray.forEach(item => { | |||
| res.push(GridSelectFactory.getGridSelectItem(item, key, valueKeys)); | |||
| }); | |||
| return res; | |||
| } | |||
| /** | |||
| * Returns single grid select item | |||
| * @param obj | |||
| * @param key | |||
| * @param valueKeys | |||
| * @param isNullItem | |||
| */ | |||
| static getGridSelectItem(obj: any, key: string, valueKeys: string[], isNullItem: boolean = false): IGridSelectItem { | |||
| if (!obj.hasOwnProperty(key)) { | |||
| @@ -127,9 +122,9 @@ export class GridSelectFactory { | |||
| let gridItem: {} = {}; | |||
| if (!isNullItem) { | |||
| for (let i = 0; i < valueKeys.length; i++) { | |||
| if (!obj.hasOwnProperty(key) || !obj.hasOwnProperty(valueKeys[i])) { | |||
| throw new Error('GridFactory: Value not found: ' + valueKeys[i]); | |||
| for (const item of valueKeys) { | |||
| if (!obj.hasOwnProperty(key) || !obj.hasOwnProperty(item)) { | |||
| throw new Error('GridFactory: Value not found: ' + item); | |||
| } | |||
| } | |||
| gridItem = { | |||
| @@ -1,6 +1,5 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {IGridSelectItem} from '../grid-select-item'; | |||
| import {isNull} from 'util'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| import {GridSelectFactory} from '../grid-select-factory'; | |||
| @@ -27,7 +26,7 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| if (isNull(params.colDef.cellEditorParams.relatesOnDgField)) { | |||
| if (null === params.colDef.cellEditorParams.relatesOnDgField) { | |||
| // Static item range (default behaviour) | |||
| this.setStaticValue(params); | |||
| } else { | |||
| @@ -41,12 +40,12 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| * @param params | |||
| */ | |||
| private setStaticValue(params: any): void { | |||
| if (this.itemRange == null || this.itemRange == undefined) { | |||
| if (this.itemRange === null || undefined === this.itemRange) { | |||
| // Item range is the same for all rows | |||
| this.itemRange = params.colDef.cellEditorParams.values as IGridSelectItem[]; | |||
| if (!isNull(params.value)) { | |||
| if (null !== params.value) { | |||
| for (let i = 0; i < this.itemRange.length; i++) { | |||
| if (this.itemRange[i].key == params.value) { | |||
| if (this.itemRange[i].key === params.value) { | |||
| this.value = this.itemRange[i].value; | |||
| break; | |||
| } | |||
| @@ -68,13 +67,13 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| const itemValueKeys: string[] = params.colDef.cellEditorParams.itemValueKeys; | |||
| // Get item range by related value | |||
| this.itemRange = params.data.hasOwnProperty(relatedValue) && !isNull(params.data[relatedValue]) ? | |||
| this.itemRange = params.data.hasOwnProperty(relatedValue) && null !== params.data[relatedValue]) ? | |||
| params.colDef.cellEditorParams.values[params.data[relatedValue]] : null; | |||
| if (!isNull(params.value) && !isNull(this.itemRange)) { | |||
| if (null !== params.value && null !== this.itemRange)) { | |||
| // let value: string = GridFactory.getGridSelectItemValue() | |||
| for (let i = 0; i < this.itemRange.length; i++) { | |||
| if (this.itemRange[i][itemKey] == params.value) { | |||
| if (this.itemRange[i][itemKey] === params.value) { | |||
| this.value = GridSelectFactory.getGridSelectItemValue(this.itemRange[i], itemValueKeys); | |||
| break; | |||
| } | |||
| @@ -1,7 +1,6 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| import {AgGridComponentConst} from '../../../components/ag-grid-component-const'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-grid-text-renderer', | |||
| @@ -16,13 +15,13 @@ export class GridTextRendererComponent extends GridRendererComponent { | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| if (this.cellParams != undefined) { | |||
| if (undefined !== this.cellParams) { | |||
| // Replace "." with "," for display purpose | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : this.value = parseFloat(parseFloat(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| if (this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| this.value = isNaN(this.value) || null === this.value) ? '' : this.value = parseFloat(parseFloat(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| } | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_INT) { | |||
| this.value = isNaN(this.value) || isNull(this.value) ? '' : this.value = parseInt(parseInt(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| this.value = isNaN(this.value) || null === this.value) ? '' : this.value = parseInt(parseInt(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,11 +1,11 @@ | |||
| import {Injectable} from '@angular/core'; | |||
| import {CanActivate, Router} from '@angular/router'; | |||
| import { Router } from '@angular/router'; | |||
| import {AppService} from '../services/app.service'; | |||
| import {Subscription} from 'rxjs/index'; | |||
| import {ILoginState} from '../model/virtual/login-state'; | |||
| @Injectable() | |||
| export class RouteInterceptor implements CanActivate { | |||
| export class RouteInterceptor { | |||
| private loginSub: Subscription; | |||
| private loginState: ILoginState; | |||
| @@ -10,9 +10,6 @@ import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {Utils} from '../utils/utils'; | |||
| import {CustomerService} from './customer.service'; | |||
| import {MeetingService} from './meeting.service'; | |||
| import {OperatorService} from './operator.service'; | |||
| import {ProductionService} from "./production.service"; | |||
| import {ServiceService} from "./service.service"; | |||
| @Injectable() | |||
| export class AppService { | |||
| @@ -29,9 +26,6 @@ export class AppService { | |||
| private router: Router, | |||
| private customerService: CustomerService, | |||
| private meetingService: MeetingService, | |||
| private operatorService: OperatorService, | |||
| private productionService: ProductionService, | |||
| private serviceService: ServiceService | |||
| ) { | |||
| this.loginState = new BehaviorSubject<ILoginState>(cacheService.getItem('loginState') as ILoginState); | |||
| this.user = new BehaviorSubject<IUser>(cacheService.getItem('user') as IUser); | |||
| @@ -124,9 +118,6 @@ export class AppService { | |||
| this.user.next(null); | |||
| this.customerService.resetCustomerServiceData(); | |||
| this.meetingService.resetMeetingServiceData(); | |||
| this.operatorService.resetOperatorServiceData(); | |||
| this.productionService.resetProductionServiceData(); | |||
| this.serviceService.resetServiceServiceData(); | |||
| this.router.navigate(['./login']); | |||
| } | |||
| ); | |||
| @@ -7,7 +7,6 @@ import {ICustomer} from '../model/entities/customer'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {ICustomerContact} from '../model/entities/customer-contact'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {isNull} from 'util'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {ICustomerNote} from '../model/entities/customer-note'; | |||
| import {ICustomerData} from '../model/virtual/customer-data'; | |||
| @@ -41,16 +40,16 @@ export class CustomerService { | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!isNull(serviceData)) { | |||
| if (!null === serviceData)) { | |||
| let bSetNewData = false; | |||
| let updatedCustomers: ICustomer[] = this.customers.getValue(); | |||
| let updatedCustomerContacts: ICustomerContact[] = this.customerContacts.getValue(); | |||
| if (!isNull(serviceData.customers)) { | |||
| if (!null === serviceData.customers)) { | |||
| // Update service data | |||
| updatedCustomers = ServiceHelper.updateServiceEntries(serviceData.customers, this.customers.getValue()) as ICustomer[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.customerContacts)) { | |||
| if (!null === serviceData.customerContacts)) { | |||
| // Update service data | |||
| updatedCustomerContacts = ServiceHelper.updateServiceEntries(serviceData.customerContacts, this.customerContacts.getValue()) as ICustomerContact[]; | |||
| bSetNewData = true; | |||
| @@ -3,7 +3,7 @@ import {HttpClient, HttpErrorResponse} from '@angular/common/http'; | |||
| import {BehaviorSubject, Observable} from 'rxjs'; | |||
| import {environment} from '../../environments/environment'; | |||
| import {finalize, tap} from 'rxjs/operators'; | |||
| import {isNull, isUndefined} from 'util'; | |||
| import {isUndefined} from 'util'; | |||
| import {MessageService} from './message.service'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {CacheService} from './cache.service'; | |||
| @@ -46,17 +46,17 @@ export class HttpService { | |||
| */ | |||
| private checkMessages(data: IApiResponse): void { | |||
| // Show optional success message | |||
| if (!isUndefined(data.success_code) && !isNull(data.success_code) && data.success_code != 0) { | |||
| if (!isUndefined(data.success_code) && null !== data.success_code && data.success_code !== 0) { | |||
| this.messageService.setSuccess(data.success_code, data.success_msg); | |||
| } | |||
| // Show optional info message | |||
| if (!isUndefined(data.info_code) && !isNull(data.info_code) && data.info_code != 0) { | |||
| if (!isUndefined(data.info_code) && null !== data.info_code && data.info_code !== 0) { | |||
| this.messageService.setInfoCode(data.info_code, data.info_msg); | |||
| } | |||
| // Show optional error message | |||
| if (!isUndefined(data.error_code) && !isNull(data.error_code) && data.error_code != 0) { | |||
| if (!isUndefined(data.error_code) && null !== data.error_code && data.error_code !== 0) { | |||
| this.messageService.setError(data.error_code, data.error_msg); | |||
| } | |||
| } | |||
| @@ -5,7 +5,6 @@ import {Router} from '@angular/router'; | |||
| import {HttpService} from './http.service'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {isNull} from 'util'; | |||
| import {saveAs} from 'file-saver'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {ICustomerNote} from '../model/entities/customer-note'; | |||
| @@ -62,34 +61,34 @@ export class MeetingService { | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!isNull(serviceData)) { | |||
| if (!null === serviceData)) { | |||
| let bSetNewData = false; | |||
| let updatedCustomerMeetings: ICustomerMeeting[] = this.customerMeetings.getValue(); | |||
| let updatedInternalMeetings: IInternalMeeting[] = this.internalMeetings.getValue(); | |||
| let updatedOperatorMeetings: IOperatorMeeting[] = this.operatorMeetings.getValue(); | |||
| let updatedProductionMeetings: IProductionMeeting[] = this.productionMeetings.getValue(); | |||
| let updatedServiceMeetings: IServiceMeeting[] = this.serviceMeetings.getValue(); | |||
| if (!isNull(serviceData.customerMeetings)) { | |||
| if (!null === serviceData.customerMeetings)) { | |||
| // Update service data | |||
| updatedCustomerMeetings = ServiceHelper.updateServiceEntries(serviceData.customerMeetings, this.customerMeetings.getValue()) as ICustomerMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.internalMeetings)) { | |||
| if (!null === serviceData.internalMeetings)) { | |||
| // Update service data | |||
| updatedInternalMeetings = ServiceHelper.updateServiceEntries(serviceData.internalMeetings, this.internalMeetings.getValue()) as IInternalMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.operatorMeetings)) { | |||
| if (!null === serviceData.operatorMeetings)) { | |||
| // Update service data | |||
| updatedOperatorMeetings = ServiceHelper.updateServiceEntries(serviceData.operatorMeetings, this.operatorMeetings.getValue()) as IOperatorMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.productionMeetings)) { | |||
| if (!null === serviceData.productionMeetings)) { | |||
| // Update service data | |||
| updatedProductionMeetings = ServiceHelper.updateServiceEntries(serviceData.productionMeetings, this.productionMeetings.getValue()) as IProductionMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.operatorMeetings)) { | |||
| if (!null === serviceData.operatorMeetings)) { | |||
| // Update service data | |||
| updatedServiceMeetings = ServiceHelper.updateServiceEntries(serviceData.serviceMeetings, this.serviceMeetings.getValue()) as IServiceMeeting[]; | |||
| bSetNewData = true; | |||
| @@ -1,239 +0,0 @@ | |||
| import {Injectable} from '@angular/core'; | |||
| import {BehaviorSubject, Observable, Subscription} from 'rxjs'; | |||
| import {CacheService} from './cache.service'; | |||
| import {Router} from '@angular/router'; | |||
| import {HttpService} from './http.service'; | |||
| import {IOperator} from '../model/entities/operator'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {IOperatorContact} from '../model/entities/operator-contact'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {isNull} from 'util'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {IOperatorNote} from '../model/entities/operator-note'; | |||
| import {IOperatorData} from '../model/virtual/operator-data'; | |||
| import {saveAs} from 'file-saver'; | |||
| @Injectable() | |||
| export class OperatorService { | |||
| private operators: BehaviorSubject<IOperator[]>; | |||
| private dataOperators$: Observable<IOperator[]>; | |||
| private operatorContacts: BehaviorSubject<IOperatorContact[]>; | |||
| private dataOperatorContacts$: Observable<IOperatorContact[]>; | |||
| private serviceDataSub: Subscription; | |||
| constructor(private httpService: HttpService, private cacheService: CacheService, private router: Router) { | |||
| this.operators = new BehaviorSubject<IOperator[]>(null); | |||
| this.dataOperators$ = this.operators.asObservable(); | |||
| this.operatorContacts = new BehaviorSubject<IOperatorContact[]>(null); | |||
| this.dataOperatorContacts$ = this.operatorContacts.asObservable(); | |||
| // Subscription for service data | |||
| this.serviceDataSub = this.httpService.getServiceData$().subscribe( | |||
| data => { | |||
| this.handleServiceData(data as IAppServiceData); | |||
| }, error => { | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Handles service data updates | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!isNull(serviceData)) { | |||
| let bSetNewData = false; | |||
| let updatedOperators: IOperator[] = this.operators.getValue(); | |||
| let updatedOperatorContacts: IOperatorContact[] = this.operatorContacts.getValue(); | |||
| if (!isNull(serviceData.operators)) { | |||
| // Update service data | |||
| updatedOperators = ServiceHelper.updateServiceEntries(serviceData.operators, this.operators.getValue()) as IOperator[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.operatorContacts)) { | |||
| // Update service data | |||
| updatedOperatorContacts = ServiceHelper.updateServiceEntries(serviceData.operatorContacts, this.operatorContacts.getValue()) as IOperatorContact[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (bSetNewData) { | |||
| this.setOperatorServiceData(updatedOperators, updatedOperatorContacts); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets operator service and cache data | |||
| * @param operators | |||
| * @param operatorContacts | |||
| */ | |||
| private setOperatorServiceData(operators: IOperator[], operatorContacts: IOperatorContact[]) { | |||
| this.operators.next(operators); | |||
| this.operatorContacts.next(operatorContacts); | |||
| } | |||
| /** | |||
| * Reset service data (on logout) | |||
| */ | |||
| public resetOperatorServiceData() { | |||
| this.operators.next(null); | |||
| this.operatorContacts.next(null); | |||
| } | |||
| /** | |||
| * Returns observable of operators | |||
| * @returns {Observable<IOperator[]>} | |||
| */ | |||
| public getOperators$(): Observable<IOperator[]> { | |||
| return this.dataOperators$; | |||
| } | |||
| /** | |||
| * Returns observable of operator contacts | |||
| * @returns {Observable<IOperator[]>} | |||
| */ | |||
| public getOperatorContacts$(): Observable<IOperatorContact[]> { | |||
| return this.dataOperatorContacts$; | |||
| } | |||
| /** | |||
| * Gets all operators | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetOperatorData(): void { | |||
| this.httpService.apiGet('get-operator-data').subscribe( | |||
| data => { | |||
| const res: IOperatorData = data.result_data as IOperatorData; | |||
| this.setOperatorServiceData(res.operators, res.operatorContacts); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Returns full operator | |||
| * @param {number} operatorId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetOperatorFull(operatorId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorId', JSON.stringify(operatorId)); | |||
| return this.httpService.apiPost('get-operator-full', formData); | |||
| } | |||
| /** | |||
| * Create operator | |||
| * @param {IOperator} operator | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateOperator(operator: IOperator): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operator', JSON.stringify(operator)); | |||
| return this.httpService.apiPost('create-operator', formData); | |||
| } | |||
| /** | |||
| * Edit operator | |||
| * @param {IOperator} operator | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditOperator(operator: IOperator): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operator', JSON.stringify(operator)); | |||
| return this.httpService.apiPost('edit-operator', formData); | |||
| } | |||
| /** | |||
| * Create operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public apiCreateOperatorContact(operatorContact: IOperatorContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorContact', JSON.stringify(operatorContact)); | |||
| return this.httpService.apiPost('create-operator-contact', formData); | |||
| } | |||
| /** | |||
| * Edit operator contact | |||
| * @param {IOperatorContact} operatorContact | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditOperatorContact(operatorContact: IOperatorContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorContact', JSON.stringify(operatorContact)); | |||
| return this.httpService.apiPost('edit-operator-contact', formData); | |||
| } | |||
| /** | |||
| * Delete operator contact | |||
| * @param {number} operatorContactId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteOperatorContact(operatorContactId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorContactId', JSON.stringify(operatorContactId)); | |||
| return this.httpService.apiPost('delete-operator-contact', formData); | |||
| } | |||
| /** | |||
| * Create operator note | |||
| * @param {IOperatorNote} operatorNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateOperatorNote(operatorNote: IOperatorNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorNote', JSON.stringify(operatorNote)); | |||
| return this.httpService.apiPost('create-operator-note', formData); | |||
| } | |||
| /** | |||
| * Edit operator note | |||
| * @param {IOperatorNote} operatorNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditOperatorNote(operatorNote: IOperatorNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorNote', JSON.stringify(operatorNote)); | |||
| return this.httpService.apiPost('edit-operator-note', formData); | |||
| } | |||
| /** | |||
| * Delete operator note | |||
| * @param {number} operatorNoteId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteOperatorNote(operatorNoteId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorNoteId', JSON.stringify(operatorNoteId)); | |||
| return this.httpService.apiPost('delete-operator-note', formData); | |||
| } | |||
| /** | |||
| * Edit operator meeting report | |||
| * @param operatorMeetingId | |||
| * @param operatorMeetingReport | |||
| */ | |||
| public apiEditOperatorMeetingReport(operatorMeetingId: number, operatorMeetingReport: string): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('operatorMeetingId', JSON.stringify(operatorMeetingId)); | |||
| formData.append('operatorMeetingReport', JSON.stringify(operatorMeetingReport)); | |||
| return this.httpService.apiPost('edit-operator-meeting-report', formData); | |||
| } | |||
| /** | |||
| * Returns meeting list as excel | |||
| * @param meetingList | |||
| * @param fileName | |||
| */ | |||
| public apiExportXmasPdf(meetingList: {}[], fileName: string): void { | |||
| const formData = new FormData(); | |||
| formData.append('meetingList', JSON.stringify(meetingList)); | |||
| this.httpService.apiFilePost('export-meeting-list', formData).subscribe( | |||
| data => { | |||
| saveAs(new Blob([data], {type: 'pdf'}), fileName + '.pdf'); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,239 +0,0 @@ | |||
| import {Injectable} from '@angular/core'; | |||
| import {BehaviorSubject, Observable, Subscription} from 'rxjs'; | |||
| import {CacheService} from './cache.service'; | |||
| import {Router} from '@angular/router'; | |||
| import {HttpService} from './http.service'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {isNull} from 'util'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {saveAs} from 'file-saver'; | |||
| import {IProduction} from '../model/entities/production'; | |||
| import {IProductionContact} from '../model/entities/production-contact'; | |||
| import {IProductionData} from '../model/virtual/production-data'; | |||
| import {IProductionNote} from '../model/entities/production-note'; | |||
| @Injectable() | |||
| export class ProductionService { | |||
| private productions: BehaviorSubject<IProduction[]>; | |||
| private dataProductions$: Observable<IProduction[]>; | |||
| private productionContacts: BehaviorSubject<IProductionContact[]>; | |||
| private dataProductionContacts$: Observable<IProductionContact[]>; | |||
| private serviceDataSub: Subscription; | |||
| constructor(private httpService: HttpService, private cacheService: CacheService, private router: Router) { | |||
| this.productions = new BehaviorSubject<IProduction[]>(null); | |||
| this.dataProductions$ = this.productions.asObservable(); | |||
| this.productionContacts = new BehaviorSubject<IProductionContact[]>(null); | |||
| this.dataProductionContacts$ = this.productionContacts.asObservable(); | |||
| // Subscription for service data | |||
| this.serviceDataSub = this.httpService.getServiceData$().subscribe( | |||
| data => { | |||
| this.handleServiceData(data as IAppServiceData); | |||
| }, error => { | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Handles service data updates | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!isNull(serviceData)) { | |||
| let bSetNewData = false; | |||
| let updatedProductions: IProduction[] = this.productions.getValue(); | |||
| let updatedProductionContacts: IProductionContact[] = this.productionContacts.getValue(); | |||
| if (!isNull(serviceData.productions)) { | |||
| // Update service data | |||
| updatedProductions = ServiceHelper.updateServiceEntries(serviceData.productions, this.productions.getValue()) as IProduction[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.productionContacts)) { | |||
| // Update service data | |||
| updatedProductionContacts = ServiceHelper.updateServiceEntries(serviceData.productionContacts, this.productionContacts.getValue()) as IProductionContact[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (bSetNewData) { | |||
| this.setProductionServiceData(updatedProductions, updatedProductionContacts); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets production service and cache data | |||
| * @param productions | |||
| * @param productionContacts | |||
| */ | |||
| private setProductionServiceData(productions: IProduction[], productionContacts: IProductionContact[]) { | |||
| this.productions.next(productions); | |||
| this.productionContacts.next(productionContacts); | |||
| } | |||
| /** | |||
| * Reset service data (on logout) | |||
| */ | |||
| public resetProductionServiceData() { | |||
| this.productions.next(null); | |||
| this.productionContacts.next(null); | |||
| } | |||
| /** | |||
| * Returns observable of productions | |||
| * @returns {Observable<IProduction[]>} | |||
| */ | |||
| public getProductions$(): Observable<IProduction[]> { | |||
| return this.dataProductions$; | |||
| } | |||
| /** | |||
| * Returns observable of production contacts | |||
| * @returns {Observable<IProductionContact[]>} | |||
| */ | |||
| public getProductionContacts$(): Observable<IProductionContact[]> { | |||
| return this.dataProductionContacts$; | |||
| } | |||
| /** | |||
| * Gets all productions | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetProductionData(): void { | |||
| this.httpService.apiGet('get-production-data').subscribe( | |||
| data => { | |||
| const res: IProductionData = data.result_data as IProductionData; | |||
| this.setProductionServiceData(res.productions, res.productionContacts); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Returns full production | |||
| * @param {number} productionId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetProductionFull(productionId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionId', JSON.stringify(productionId)); | |||
| return this.httpService.apiPost('get-production-full', formData); | |||
| } | |||
| /** | |||
| * Create production | |||
| * @param {IProduction} production | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateProduction(production: IProduction): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('production', JSON.stringify(production)); | |||
| return this.httpService.apiPost('create-production', formData); | |||
| } | |||
| /** | |||
| * Edit production | |||
| * @param {IProduction} production | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditProduction(production: IProduction): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('production', JSON.stringify(production)); | |||
| return this.httpService.apiPost('edit-production', formData); | |||
| } | |||
| /** | |||
| * Create production contact | |||
| * @param productionContact | |||
| */ | |||
| public apiCreateProductionContact(productionContact: IProductionContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionContact', JSON.stringify(productionContact)); | |||
| return this.httpService.apiPost('create-production-contact', formData); | |||
| } | |||
| /** | |||
| * Edit production contact | |||
| * @param {IProductionContact} productionContact | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditProductionContact(productionContact: IProductionContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionContact', JSON.stringify(productionContact)); | |||
| return this.httpService.apiPost('edit-production-contact', formData); | |||
| } | |||
| /** | |||
| * Delete production contact | |||
| * @param {number} productionContactId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteProductionContact(productionContactId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionContactId', JSON.stringify(productionContactId)); | |||
| return this.httpService.apiPost('delete-production-contact', formData); | |||
| } | |||
| /** | |||
| * Create production note | |||
| * @param {IProductionNote} productionNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateProductionNote(productionNote: IProductionNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionNote', JSON.stringify(productionNote)); | |||
| return this.httpService.apiPost('create-production-note', formData); | |||
| } | |||
| /** | |||
| * Edit production note | |||
| * @param {IProductionNote} productionNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditProductionNote(productionNote: IProductionNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionNote', JSON.stringify(productionNote)); | |||
| return this.httpService.apiPost('edit-production-note', formData); | |||
| } | |||
| /** | |||
| * Delete production note | |||
| * @param {number} productionNoteId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteProductionNote(productionNoteId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionNoteId', JSON.stringify(productionNoteId)); | |||
| return this.httpService.apiPost('delete-production-note', formData); | |||
| } | |||
| /** | |||
| * Edit production meeting report | |||
| * @param productionMeetingId | |||
| * @param productionMeetingReport | |||
| */ | |||
| public apiEditProductionMeetingReport(productionMeetingId: number, productionMeetingReport: string): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('productionMeetingId', JSON.stringify(productionMeetingId)); | |||
| formData.append('productionMeetingReport', JSON.stringify(productionMeetingReport)); | |||
| return this.httpService.apiPost('edit-production-meeting-report', formData); | |||
| } | |||
| /** | |||
| * Returns meeting list as excel | |||
| * @param meetingList | |||
| * @param fileName | |||
| */ | |||
| public apiExportXmasPdf(meetingList: {}[], fileName: string): void { | |||
| const formData = new FormData(); | |||
| formData.append('meetingList', JSON.stringify(meetingList)); | |||
| this.httpService.apiFilePost('export-meeting-list', formData).subscribe( | |||
| data => { | |||
| saveAs(new Blob([data], {type: 'pdf'}), fileName + '.pdf'); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,239 +0,0 @@ | |||
| import {Injectable} from '@angular/core'; | |||
| import {BehaviorSubject, Observable, Subscription} from 'rxjs'; | |||
| import {CacheService} from './cache.service'; | |||
| import {Router} from '@angular/router'; | |||
| import {HttpService} from './http.service'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {isNull} from 'util'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {saveAs} from 'file-saver'; | |||
| import {IService} from '../model/entities/service'; | |||
| import {IServiceContact} from '../model/entities/service-contact'; | |||
| import {IServiceData} from '../model/virtual/service-data'; | |||
| import {IServiceNote} from '../model/entities/service-note'; | |||
| @Injectable() | |||
| export class ServiceService { | |||
| private services: BehaviorSubject<IService[]>; | |||
| private dataServices$: Observable<IService[]>; | |||
| private serviceContacts: BehaviorSubject<IServiceContact[]>; | |||
| private dataServiceContacts$: Observable<IServiceContact[]>; | |||
| private serviceDataSub: Subscription; | |||
| constructor(private httpService: HttpService, private cacheService: CacheService, private router: Router) { | |||
| this.services = new BehaviorSubject<IService[]>(null); | |||
| this.dataServices$ = this.services.asObservable(); | |||
| this.serviceContacts = new BehaviorSubject<IServiceContact[]>(null); | |||
| this.dataServiceContacts$ = this.serviceContacts.asObservable(); | |||
| // Subscription for service data | |||
| this.serviceDataSub = this.httpService.getServiceData$().subscribe( | |||
| data => { | |||
| this.handleServiceData(data as IAppServiceData); | |||
| }, error => { | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Handles service data updates | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!isNull(serviceData)) { | |||
| let bSetNewData = false; | |||
| let updatedServices: IService[] = this.services.getValue(); | |||
| let updatedServiceContacts: IServiceContact[] = this.serviceContacts.getValue(); | |||
| if (!isNull(serviceData.services)) { | |||
| // Update service data | |||
| updatedServices = ServiceHelper.updateServiceEntries(serviceData.services, this.services.getValue()) as IService[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!isNull(serviceData.serviceContacts)) { | |||
| // Update service data | |||
| updatedServiceContacts = ServiceHelper.updateServiceEntries(serviceData.serviceContacts, this.serviceContacts.getValue()) as IServiceContact[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (bSetNewData) { | |||
| this.setServiceServiceData(updatedServices, updatedServiceContacts); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets service service and cache data | |||
| * @param services | |||
| * @param serviceContacts | |||
| */ | |||
| private setServiceServiceData(services: IService[], serviceContacts: IServiceContact[]) { | |||
| this.services.next(services); | |||
| this.serviceContacts.next(serviceContacts); | |||
| } | |||
| /** | |||
| * Reset service data (on logout) | |||
| */ | |||
| public resetServiceServiceData() { | |||
| this.services.next(null); | |||
| this.serviceContacts.next(null); | |||
| } | |||
| /** | |||
| * Returns observable of services | |||
| * @returns {Observable<IService[]>} | |||
| */ | |||
| public getServices$(): Observable<IService[]> { | |||
| return this.dataServices$; | |||
| } | |||
| /** | |||
| * Returns observable of service contacts | |||
| * @returns {Observable<IService[]>} | |||
| */ | |||
| public getServiceContacts$(): Observable<IServiceContact[]> { | |||
| return this.dataServiceContacts$; | |||
| } | |||
| /** | |||
| * Gets all services | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetServiceData(): void { | |||
| this.httpService.apiGet('get-service-data').subscribe( | |||
| data => { | |||
| const res: IServiceData = data.result_data as IServiceData; | |||
| this.setServiceServiceData(res.services, res.serviceContacts); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Returns full service | |||
| * @param {number} serviceId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetServiceFull(serviceId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceId', JSON.stringify(serviceId)); | |||
| return this.httpService.apiPost('get-service-full', formData); | |||
| } | |||
| /** | |||
| * Create service | |||
| * @param {IService} service | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateService(service: IService): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('service', JSON.stringify(service)); | |||
| return this.httpService.apiPost('create-service', formData); | |||
| } | |||
| /** | |||
| * Edit service | |||
| * @param {IService} service | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditService(service: IService): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('service', JSON.stringify(service)); | |||
| return this.httpService.apiPost('edit-service', formData); | |||
| } | |||
| /** | |||
| * Create service contact | |||
| * @param serviceContact | |||
| */ | |||
| public apiCreateServiceContact(serviceContact: IServiceContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceContact', JSON.stringify(serviceContact)); | |||
| return this.httpService.apiPost('create-service-contact', formData); | |||
| } | |||
| /** | |||
| * Edit service contact | |||
| * @param {IServiceContact} serviceContact | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditServiceContact(serviceContact: IServiceContact): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceContact', JSON.stringify(serviceContact)); | |||
| return this.httpService.apiPost('edit-service-contact', formData); | |||
| } | |||
| /** | |||
| * Delete service contact | |||
| * @param {number} serviceContactId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteServiceContact(serviceContactId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceContactId', JSON.stringify(serviceContactId)); | |||
| return this.httpService.apiPost('delete-service-contact', formData); | |||
| } | |||
| /** | |||
| * Create service note | |||
| * @param {IServiceNote} serviceNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateServiceNote(serviceNote: IServiceNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceNote', JSON.stringify(serviceNote)); | |||
| return this.httpService.apiPost('create-service-note', formData); | |||
| } | |||
| /** | |||
| * Edit service note | |||
| * @param {IServiceNote} serviceNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditServiceNote(serviceNote: IServiceNote): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceNote', JSON.stringify(serviceNote)); | |||
| return this.httpService.apiPost('edit-service-note', formData); | |||
| } | |||
| /** | |||
| * Delete service note | |||
| * @param {number} serviceNoteId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteServiceNote(serviceNoteId: number): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceNoteId', JSON.stringify(serviceNoteId)); | |||
| return this.httpService.apiPost('delete-service-note', formData); | |||
| } | |||
| /** | |||
| * Edit service meeting report | |||
| * @param serviceMeetingId | |||
| * @param serviceMeetingReport | |||
| */ | |||
| public apiEditServiceMeetingReport(serviceMeetingId: number, serviceMeetingReport: string): Observable<IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('serviceMeetingId', JSON.stringify(serviceMeetingId)); | |||
| formData.append('serviceMeetingReport', JSON.stringify(serviceMeetingReport)); | |||
| return this.httpService.apiPost('edit-service-meeting-report', formData); | |||
| } | |||
| /** | |||
| * Returns meeting list as excel | |||
| * @param meetingList | |||
| * @param fileName | |||
| */ | |||
| public apiExportXmasPdf(meetingList: {}[], fileName: string): void { | |||
| const formData = new FormData(); | |||
| formData.append('meetingList', JSON.stringify(meetingList)); | |||
| this.httpService.apiFilePost('export-meeting-list', formData).subscribe( | |||
| data => { | |||
| saveAs(new Blob([data], {type: 'pdf'}), fileName + '.pdf'); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| import {isNull} from 'util'; | |||
| import {null === } from 'util'; | |||
| export class Utils { | |||
| @@ -29,8 +29,8 @@ export class Utils { | |||
| */ | |||
| static getSortedObjFromArray(paramArray: Array<any> = null, criteria: string = null) { | |||
| const res: {} = {}; | |||
| if (!isNull(paramArray)) { | |||
| if (!isNull(criteria)) { | |||
| if (!null === paramArray)) { | |||
| if (!null === criteria)) { | |||
| for (let i = 0; i < paramArray.length; i++) { | |||
| res[paramArray[i][criteria]] = paramArray[i]; | |||
| } | |||
| @@ -148,7 +148,7 @@ export class Utils { | |||
| */ | |||
| static getDateTimeToDisplay(dateString: string = null, withDate: boolean = true, withTime: boolean = false, withSeconds: boolean = false, forDatePicker: boolean = false): string { | |||
| let res = ''; | |||
| const date: Date = isNull(dateString) ? new Date() : new Date(dateString.replace(/\s/, 'T')); | |||
| const date: Date = null === dateString) ? new Date() : new Date(dateString.replace(/\s/, 'T')); | |||
| const day: number = date.getDate(); | |||
| const month: number = date.getMonth() + 1; | |||
| const year: number = date.getFullYear(); | |||
| @@ -189,7 +189,7 @@ export class Utils { | |||
| * @param url | |||
| */ | |||
| static checkUrl(url: string): string { | |||
| if (!isNull(url)) { | |||
| if (!null === url)) { | |||
| let newUrl = decodeURIComponent(url); | |||
| newUrl = newUrl.trim().replace(/\s/g, ''); | |||
| if (/^(:\/\/)/.test(newUrl)) { | |||
| @@ -6,7 +6,6 @@ import {ModalComponent} from '../../../components/modal/modal.component'; | |||
| import {CustomerContactPersonDetailComponent} from '../customer-view/customer-contact-person-detail/customer-contact-person-detail.component'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| import {CustomerService} from '../../../services/customer.service'; | |||
| import {isNull} from 'util'; | |||
| import {Const} from '../../../utils/const'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {CommonService} from '../../../services/common.service'; | |||
| @@ -80,7 +79,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| if (!isNull(this.customerContacts)) { | |||
| if (null !== this.customerContacts)) { | |||
| for (let i = 0; i < this.customerContacts.length; i++) { | |||
| this.rowData.push({ | |||
| id: this.customerContacts[i].id, | |||
| @@ -3,7 +3,6 @@ import {AgGridComponent} from '../../../components/ag-grid-component'; | |||
| import {ICustomer} from '../../../model/entities/customer'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {Const} from '../../../utils/const'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-customer-list', | |||
| @@ -73,7 +72,7 @@ export class CustomerListComponent extends AgGridComponent implements OnInit { | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| if (!isNull(this.customers)) { | |||
| if (null !== this.customers) { | |||
| for (let i = 0; i < this.customers.length; i++) { | |||
| this.rowData.push({ | |||
| customer_id: this.customers[i].id, | |||
| @@ -82,8 +81,8 @@ export class CustomerListComponent extends AgGridComponent implements OnInit { | |||
| customer_name: this.customers[i].name, | |||
| customer_name_additional: this.customers[i].name_additional, | |||
| old_plp_id: this.customers[i].old_plp_id, | |||
| v_consultant: !isNull(this.customers[i].consultant_user_id) ? | |||
| this.usersById[this.customers[i].consultant_user_id].firstname + ' ' + this.usersById[this.customers[i].consultant_user_id].lastname : null, | |||
| v_consultant: null !== this.customers[i].consultant_user_id ?? | |||
| this.usersById[this.customers[i].consultant_user_id].firstname + ' ' + this.usersById[this.customers[i].consultant_user_id].lastname, | |||
| street: this.customers[i].street, | |||
| street_no: this.customers[i].street_no, | |||
| zip: this.customers[i].zip, | |||
| @@ -15,7 +15,6 @@ import {ICustomerMeeting} from '../../model/entities/customer-meeting'; | |||
| import {CustomerListComponent} from './customer-list/customer-list.component'; | |||
| import {CustomerContactListComponent} from './customer-contact-list/customer-contact-list.component'; | |||
| import {MeetingService} from '../../services/meeting.service'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-customer-management', | |||
| @@ -68,7 +67,7 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| * Set component data after all data has been received | |||
| */ | |||
| private setComponentData() { | |||
| if (!isNull(this.customers) && !isNull(this.customerContacts)) { | |||
| if (null !== this.customers && null !== this.customerContacts)) { | |||
| this.customerList.setData(this.customers); | |||
| this.customerContactList.setData(this.customers, this.customerContacts); | |||
| } | |||
| @@ -47,20 +47,18 @@ export class CustomerContactPersonDetailComponent implements OnInit { | |||
| /** | |||
| * Updates data | |||
| * @param customer | |||
| */ | |||
| public updateData(customer: ICustomer): void { | |||
| this.setContactPersonData(customer); | |||
| for (let i = 0; i < this.customer.v_customer_contacts.length; i++) { | |||
| if (this.customer.v_customer_contacts[i].id == this.customerContact.id) { | |||
| this.customerContact = this.customer.v_customer_contacts[i]; | |||
| this.customer.v_customer_contacts.forEach((value) => { | |||
| if (value.id === this.customerContact.id) { | |||
| this.customerContact = value; | |||
| } | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * Sets contact person data | |||
| * @param customer | |||
| */ | |||
| public setContactPersonData(customer: ICustomer): void { | |||
| this.isEditMode = false; | |||
| @@ -77,7 +75,6 @@ export class CustomerContactPersonDetailComponent implements OnInit { | |||
| /** | |||
| * Edits meeting entry | |||
| * @param customerContact | |||
| */ | |||
| public editCustomerContactFunction(customerContact: ICustomerContact) { | |||
| this.editCustomerContact.emit(customerContact); | |||
| @@ -2,7 +2,6 @@ import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core' | |||
| import {ICustomerContact} from '../../../../model/entities/customer-contact'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {isNull} from 'util'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| @@ -39,7 +38,7 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| */ | |||
| public setData(customerContact: ICustomerContact): void { | |||
| this.customerContact = customerContact; | |||
| this.isCreationMode = isNull(this.customerContact.id); | |||
| this.isCreationMode = null === this.customerContact.id; | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| @@ -60,8 +59,8 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| // Check if date is valid | |||
| if (isNull(this.customerContact.date_of_birth) || | |||
| (!isNull(this.customerContact.date_of_birth) && Utils.isValidDate(this.customerContact.date_of_birth))) { | |||
| if (null === this.customerContact.date_of_birth || | |||
| !(null === this.customerContact.date_of_birth && Utils.isValidDate(this.customerContact.date_of_birth))) { | |||
| if (this.isCreationMode) { | |||
| this.createCustomerContact.emit(this.customerContact); | |||
| } else { | |||
| @@ -5,7 +5,6 @@ import {ICustomerContact} from '../../../../model/entities/customer-contact'; | |||
| import {AgGridComponent} from '../../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {CustomerContactPersonEditComponent} from '../customer-contact-person-edit/customer-contact-person-edit.component'; | |||
| import {isNull} from 'util'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| @@ -115,7 +114,7 @@ export class CustomerContactPersonViewComponent extends AgGridComponent implemen | |||
| street_no: this.customerContacts[i].street_no, | |||
| zip: this.customerContacts[i].zip, | |||
| city: this.customerContacts[i].city, | |||
| country: !isNull(this.customerContacts[i].country_id) ? this.config.vc_countries_by_id[this.customerContacts[i].country_id].name : null, | |||
| country: null !== this.customerContacts[i].country_id ? this.config.vc_countries_by_id[this.customerContacts[i].country_id].name : null, | |||
| comment: this.customerContacts[i].comment, | |||
| }); | |||
| } | |||
| @@ -2,7 +2,6 @@ import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core' | |||
| import {ICustomer} from '../../../../model/entities/customer'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {isNull} from 'util'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| @@ -45,7 +44,7 @@ export class CustomerDataEditComponent extends FormComponent implements OnInit { | |||
| */ | |||
| public setData(customer: ICustomer): void { | |||
| this.customer = customer; | |||
| this.isCreationMode = isNull(this.customer.id); | |||
| this.isCreationMode = null === this.customer.id; | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| @@ -19,7 +19,7 @@ import {IConfig} from '../../../../model/virtual/config'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {CustomerService} from '../../../../services/customer.service'; | |||
| import {isNull} from 'util'; | |||
| import {null === } from 'util'; | |||
| import {MeetingService} from '../../../../services/meeting.service'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {Const} from '../../../../utils/const'; | |||
| @@ -101,7 +101,7 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| */ | |||
| public updateData(customer: ICustomer): void { | |||
| this.customer = customer; | |||
| if (!isNull(this.customerMeeting.id)) { | |||
| if (!null === this.customerMeeting.id)) { | |||
| for (let i = 0; i < this.customer.v_customer_meetings.length; i++) { | |||
| if (this.customer.v_customer_meetings[i].id === this.customerMeeting.id) { | |||
| this.customerMeeting = this.customer.v_customer_meetings[i]; | |||
| @@ -10,7 +10,6 @@ import {AppService} from '../../../../services/app.service'; | |||
| import {IUser} from '../../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {isNull} from 'util'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| @Component({ | |||
| @@ -112,7 +111,7 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| } | |||
| } | |||
| if (isNull(this.customerMeeting.customer_contact_id)) { | |||
| if (null === this.customerMeeting.customer_contact_id) { | |||
| this.customerMeeting.customer_contact_id = -1; | |||
| } | |||
| if (this.customerMeeting.customer_contact_id > 0) { | |||
| @@ -10,7 +10,6 @@ import {CustomerMeetingDetailComponent} from '../customer-meeting-detail/custome | |||
| import {IUser} from '../../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {isNull} from 'util'; | |||
| import {Const} from '../../../../utils/const'; | |||
| @Component({ | |||
| @@ -110,39 +109,38 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| const items: {}[] = []; | |||
| for (let i = 0; i < this.customerMeeting.length; i++) { | |||
| this.owner = this.appService.getConfig().vc_user_by_id[this.customerMeeting[i].owner_user_id]; | |||
| this.meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.customerMeeting[i].meeting_type_id]; | |||
| let customerContactName: string = !isNull(this.customerMeeting[i].firstname) ? this.customerMeeting[i].firstname + ' ' : ''; | |||
| customerContactName += !isNull(this.customerMeeting[i].lastname) ? this.customerMeeting[i].lastname : ''; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.customerMeeting[i].creation_user_id]; | |||
| this.customerMeeting.forEach((value) => { | |||
| this.owner = this.appService.getConfig().vc_user_by_id[value.owner_user_id]; | |||
| this.meetingType = this.appService.getConfig().vc_meeting_types_by_id[value.meeting_type_id]; | |||
| let customerContactName: string = null === value.firstname ? value.firstname + ' ' : ''; | |||
| customerContactName += null === value.lastname ? value.lastname : ''; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[value.creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| id: this.customerMeeting[i].id, | |||
| title: this.customerMeeting[i].title, | |||
| date: this.customerMeeting[i].start_date, | |||
| time_start: this.customerMeeting[i].start_date, | |||
| time_end: this.customerMeeting[i].end_date, | |||
| id: value.id, | |||
| title: value.title, | |||
| date: value.start_date, | |||
| time_start: value.start_date, | |||
| time_end: value.end_date, | |||
| type: this.meetingType.name, | |||
| typeType: this.meetingType.type, | |||
| is_option_meeting: this.customerMeeting[i].is_option_meeting, | |||
| street: this.customerMeeting[i].street, | |||
| street_no: this.customerMeeting[i].street_no, | |||
| zip: this.customerMeeting[i].zip, | |||
| city: this.customerMeeting[i].city, | |||
| is_option_meeting: value.is_option_meeting, | |||
| street: value.street, | |||
| street_no: value.street_no, | |||
| zip: value.zip, | |||
| city: value.city, | |||
| owner: this.owner.firstname + ' ' + this.owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| customerContactName, | |||
| participants: this.customerMeeting[i].v_participants, | |||
| department: this.customerMeeting[i].department, | |||
| email: this.customerMeeting[i].email, | |||
| phone: this.customerMeeting[i].phone_no, | |||
| mobile: this.customerMeeting[i].mobile_no, | |||
| participants: value.v_participants, | |||
| department: value.department, | |||
| email: value.email, | |||
| phone: value.phone_no, | |||
| mobile: value.mobile_no, | |||
| }); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['date'], b['date'], false)); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| @@ -6,7 +6,6 @@ import {ICustomer} from '../../../../model/entities/customer'; | |||
| import {ICustomerContact} from '../../../../model/entities/customer-contact'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {isNull} from 'util'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| @Component({ | |||
| @@ -58,7 +57,7 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| this.contactId = ''; | |||
| this.isCreationMode = isCreationMode; | |||
| this.errorMsg = ''; | |||
| if (isNull(this.customerNote.customer_contact_id)) { | |||
| if (null === this.customerNote.customer_contact_id) { | |||
| this.customerNote.customer_contact_id = -1; | |||
| } | |||
| if (this.customerNote.customer_contact_id > 0) { | |||
| @@ -1,5 +1,5 @@ | |||
| import { Component, OnInit } from '@angular/core'; | |||
| import {FormBuilder, FormGroup, Validators} from '@angular/forms'; | |||
| import {UntypedFormBuilder, UntypedFormGroup, Validators} from '@angular/forms'; | |||
| import {environment} from '../../../environments/environment'; | |||
| import {AppService} from '../../services/app.service'; | |||
| import {Subscription} from 'rxjs'; | |||
| @@ -16,7 +16,7 @@ export class LoginComponent implements OnInit { | |||
| private loginSub: Subscription; | |||
| public isLoggedIn: boolean; | |||
| public errorMsg: string; | |||
| public loginForm: FormGroup; | |||
| public loginForm: UntypedFormGroup; | |||
| /** | |||
| * Gets email | |||
| @@ -32,7 +32,7 @@ export class LoginComponent implements OnInit { | |||
| return this.loginForm.get('password'); | |||
| } | |||
| constructor(private router: Router, public appService: AppService, private fb: FormBuilder) { | |||
| constructor(private router: Router, public appService: AppService, private fb: UntypedFormBuilder) { | |||
| this.errorMsg = ''; | |||
| } | |||
| @@ -1,48 +0,0 @@ | |||
| <div [hidden]="isEditMode"> | |||
| <h3>Ansprechpartner Detail</h3> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Gesprächspartner:</dt> | |||
| <dd><span *ngIf="operatorContact.gender == 'male'">Herr </span> | |||
| <span *ngIf="operatorContact.gender == 'female'">Frau </span> | |||
| <span *ngIf="operatorContact.gender == 'diverse'">Divers </span>{{operatorContact.firstname}} {{operatorContact.lastname}}</dd> | |||
| <dt *ngIf="operatorContact.department">Abteilung:</dt> | |||
| <dd *ngIf="operatorContact.department">{{operatorContact.department}}</dd> | |||
| <dt *ngIf="operatorContact.email">E-Mail:</dt> | |||
| <dd *ngIf="operatorContact.email"><a href="mailto:{{operatorContact.email}}">{{operatorContact.email}}</a></dd> | |||
| <dt *ngIf="operatorContact.phone_no">Telefon:</dt> | |||
| <dd *ngIf="operatorContact.phone_no"><a href="tel:{{operatorContact.phone_no}}">{{operatorContact.phone_no}}</a></dd> | |||
| <dt *ngIf="operatorContact.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="operatorContact.mobile_no"><a href="tel:{{operatorContact.mobile_no}}">{{operatorContact.mobile_no}}</a></dd> | |||
| <dt *ngIf="operatorContact.fax_no">Fax:</dt> | |||
| <dd *ngIf="operatorContact.fax_no">{{operatorContact.fax_no}}</dd> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{operatorContact.street}} {{operatorContact.street_no}}<br /> | |||
| {{operatorContact.zip}} {{operatorContact.city}} | |||
| <ng-container *ngIf="operatorContact.country_id != null"><br />{{config.vc_countries_by_id[operatorContact.country_id]['name']}}</ng-container></dd> | |||
| <dt *ngIf="operatorContact.comment">Notiz:</dt> | |||
| <dd class="pre-wrap" *ngIf="operatorContact.comment">{{operatorContact.comment}}</dd> | |||
| <dt>Markiert für Weihnachtspost:</dt> | |||
| <dd> | |||
| <span *ngIf="operatorContact.is_xmas_mail_recipient">Ja</span> | |||
| <span *ngIf="!operatorContact.is_xmas_mail_recipient">Nein</span> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| <div class="form" *ngIf="hasEditRights"> | |||
| <div class="row row--last"> | |||
| <div class="column button-row"> | |||
| <span class="button-row--link" (click)="operatorShortcut()">Zum Betreiberprofil</span> | |||
| <div class="button button--inline" (click)="editEntry()">Eintrag bearbeiten</div> | |||
| <div class="button button--inline" (click)="deleteEntry()">Eintrag löschen</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div [hidden]="!isEditMode"> | |||
| <div id="operator-contact-person-edit-modal"> | |||
| <app-operator-contact-person-edit #operatorContactEdit (editOperatorContact)="editOperatorContactFunction($event)"></app-operator-contact-person-edit> | |||
| </div> | |||
| </div> | |||
| @@ -1,105 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperatorContact} from '../../../../model/entities/operator-contact'; | |||
| import {OperatorContactPersonEditComponent} from '../operator-contact-person-edit/operator-contact-person-edit.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-contact-person-detail', | |||
| templateUrl: './operator-contact-person-detail.component.html', | |||
| styleUrls: ['./operator-contact-person-detail.component.scss'] | |||
| }) | |||
| export class OperatorContactPersonDetailComponent implements OnInit { | |||
| @Output() deleteOperatorContact: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() editOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() shortcut: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('operatorContactEdit', { static: true }) operatorContactEdit: OperatorContactPersonEditComponent; | |||
| public isEditMode: boolean; | |||
| public operator: IOperator; | |||
| public operatorContact: IOperatorContact; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(public appService: AppService) { } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.config = this.appService.getConfig(); | |||
| this.isEditMode = false; | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorContact = Factory.getEmptyOperatorContact(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| */ | |||
| public setData(operator: IOperator, operatorContact: IOperatorContact): void { | |||
| this.setContactPersonData(operator); | |||
| this.operatorContact = operatorContact; | |||
| } | |||
| /** | |||
| * Updates data | |||
| * @param operator | |||
| */ | |||
| public updateData(operator: IOperator): void { | |||
| this.setContactPersonData(operator); | |||
| for (let i = 0; i < this.operator.v_operator_contacts.length; i++) { | |||
| if (this.operator.v_operator_contacts[i].id == this.operatorContact.id) { | |||
| this.operatorContact = this.operator.v_operator_contacts[i]; | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets contact person data | |||
| * @param operator | |||
| */ | |||
| public setContactPersonData(operator: IOperator): void { | |||
| this.isEditMode = false; | |||
| this.operator = operator; | |||
| } | |||
| /** | |||
| * Edit contact entry | |||
| */ | |||
| public editEntry(): void { | |||
| this.isEditMode = true; | |||
| this.operatorContactEdit.setData(Utils.deepClone(this.operatorContact) as IOperatorContact); | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param operatorContact | |||
| */ | |||
| public editOperatorContactFunction(operatorContact: IOperatorContact) { | |||
| this.editOperatorContact.emit(operatorContact); | |||
| } | |||
| /** | |||
| * Delete contact entry | |||
| */ | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Ansprechpartner wirklich löschen?'); | |||
| if (confirmAction == true) { | |||
| this.deleteOperatorContact.emit(this.operatorContact.id); | |||
| } | |||
| } | |||
| /** | |||
| * Shortcut to operator detail | |||
| */ | |||
| public operatorShortcut(): void { | |||
| this.shortcut.emit(this.operator); | |||
| } | |||
| } | |||
| @@ -1,135 +0,0 @@ | |||
| <h3 *ngIf="isCreationMode">Ansprechpartner anlegen</h3> | |||
| <h3 *ngIf="!isCreationMode">Ansprechpartner bearbeiten</h3> | |||
| <form class="form" #operatorContactForm="ngForm" (ngSubmit)="onFormSubmit(operatorContactForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required"> | |||
| Anrede ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required" class="error-msg"> | |||
| Nachname ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern" class="error-msg"> | |||
| Bitte gültige E-Mail Adresse eingeben. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeGender" [class.error]="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required"><strong>Anrede*</strong></label> | |||
| <select id="ccpeGender" [class.error]="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required" | |||
| name="ccpeGender" required [(ngModel)]="operatorContact.gender" #ccpeGender="ngModel"> | |||
| <option [ngValue]=null>Anrede wählen</option> | |||
| <option value="male">Herr</option> | |||
| <option value="female">Frau</option> | |||
| <option value="diverse">Divers</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeFirstname">Vorname</label> | |||
| <input type="text" id="ccpeFirstname" name="ccpeFirstname" [(ngModel)]="operatorContact.firstname" #ccpeFirstname="ngModel" | |||
| placeholder="Brigitte"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeLastname" [class.error]="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required"><strong>Nachname*</strong></label> | |||
| <input type="text" [class.error]="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required" id="ccpeLastname" name="ccpeLastname" [(ngModel)]="operatorContact.lastname" required | |||
| #ccpeLastname="ngModel" placeholder="Mustermann"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeDepartment">Abteilung</label> | |||
| <input type="text" id="ccpeDepartment" name="ccpeDepartment" [(ngModel)]="operatorContact.department" #ccpeDepartment="ngModel" | |||
| placeholder="Marketing"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeEmail" [class.error]="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern">E-Mail</label> | |||
| <input type="email" [class.error]="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern" id="ccpeEmail" name="ccpeEmail" [(ngModel)]="operatorContact.email" #ccpeEmail="ngModel" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpePhoneNo">Telefon</label> | |||
| <input type="text" id="ccpePhoneNo" name="ccpePhoneNo" [(ngModel)]="operatorContact.phone_no" | |||
| placeholder="040-1234567" #ccpePhoneNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeMobileNo">Mobil</label> | |||
| <input type="text" id="ccpeMobileNo" name="ccpeMobileNo" [(ngModel)]="operatorContact.mobile_no" | |||
| placeholder="0177-1234567" #ccpeMobileNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeFaxNo">Fax</label> | |||
| <input type="text" id="ccpeFaxNo" name="ccpeFaxNo" [(ngModel)]="operatorContact.fax_no" | |||
| placeholder="040-1234568" #ccpeFaxNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeDateOfBirth">Geburtsdatum</label> | |||
| <input type="date" id="ccpeDateOfBirth" name="ccpeDateOfBirth" [(ngModel)]="operatorContact.date_of_birth" | |||
| placeholder="01.01.1979" #ccpeDateOfBirth="ngModel"/> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="ccpeComment" name="ccpeComment" [(ngModel)]="operatorContact.comment" #ccpeComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeStreet">Straße</label> | |||
| <input type="text" id="ccpeStreet" name="ccpeStreet" [(ngModel)]="operatorContact.street" | |||
| placeholder="Musterstraße" #ccpeStreet="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeStreetNo">Hausnummer</label> | |||
| <input type="text" id="ccpeStreetNo" name="ccpeStreetNo" [(ngModel)]="operatorContact.street_no" | |||
| placeholder="1a" #ccpeStreetNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeZip">PLZ</label> | |||
| <input type="text" id="ccpeZip" name="ccpeZip" [(ngModel)]="operatorContact.zip" | |||
| placeholder="12345" #ccpeZip="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeCity">Ort</label> | |||
| <input type="text" id="ccpeCity" name="ccpeCity" [(ngModel)]="operatorContact.city" | |||
| placeholder="Musterstadt" #ccpeCity="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cdeCountry">Land</label> | |||
| <select id="cdeCountry" name="cdeCountry" [(ngModel)]="operatorContact.country_id" #cdeCountry="ngModel"> | |||
| <option [ngValue]=null>Land wählen</option> | |||
| <option *ngFor="let c of config.countries" value="{{ c.id }}">{{ c.name }}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeXmas">Markiert für Weihnachtspost</label> | |||
| <input type="checkbox" id="ccpeXmas" name="ccpeXmas" [(ngModel)]="operatorContact.is_xmas_mail_recipient" #ccpeXmas="ngModel"/> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!operatorContactForm.valid" title="Ansprechpartner speichern" *ngIf="!isCreationMode">Ansprechpartner speichern</button> | |||
| <button class="button" [disabled]="!operatorContactForm.valid" title="Ansprechpartner anlegen" *ngIf="isCreationMode">Ansprechpartner anlegen</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,80 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {isNull} from 'util'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperatorContact} from '../../../../model/entities/operator-contact'; | |||
| @Component({ | |||
| selector: 'app-operator-contact-person-edit', | |||
| templateUrl: './operator-contact-person-edit.component.html', | |||
| styleUrls: ['./operator-contact-person-edit.component.scss'] | |||
| }) | |||
| export class OperatorContactPersonEditComponent extends FormComponent implements OnInit { | |||
| @Output() createOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() editOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @ViewChild('operatorContactForm', { static: true }) operatorContactForm: NgForm; | |||
| public operatorContact: IOperatorContact; | |||
| public config: IConfig; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.operatorContact = Factory.getEmptyOperatorContact(); | |||
| this.config = this.appService.getConfig(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operatorContact | |||
| */ | |||
| public setData(operatorContact: IOperatorContact): void { | |||
| this.operatorContact = operatorContact; | |||
| this.isCreationMode = isNull(this.operatorContact.id); | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.operatorContactForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| // Check if date is valid | |||
| if (isNull(this.operatorContact.date_of_birth) || | |||
| (!isNull(this.operatorContact.date_of_birth) && Utils.isValidDate(this.operatorContact.date_of_birth))) { | |||
| if (this.isCreationMode) { | |||
| this.createOperatorContact.emit(this.operatorContact); | |||
| } else { | |||
| this.editOperatorContact.emit(this.operatorContact); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(this.isCreationMode ? 'operator-contact-person-modal' : 'operator-contact-person-edit-modal'); | |||
| } | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'operator-contact-person-modal' : 'operator-contact-person-edit-modal'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,35 +0,0 @@ | |||
| <h3>Ansprechpartner</h3> | |||
| <p>Hier sind die Ansprechpartner zu sehen:</p> | |||
| <div class="button" id="create-operator-contact" (click)="create()" *ngIf="hasEditRights">Ansprechpartner anlegen</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [enableCellTextSelection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalOperatorContactPersonDetail> | |||
| <app-operator-contact-person-detail #operatorContactPersonDetail (editOperatorContact)="editOperatorContactFunction($event)" | |||
| (deleteOperatorContact)="deleteOperatorContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-operator-contact-person-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalOperatorContactPersonEdit> | |||
| <div id="operator-contact-person-modal"> | |||
| <app-operator-contact-person-edit #operatorContactPersonEdit | |||
| (createOperatorContact)="createOperatorContactFunction($event)"></app-operator-contact-person-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,14 +0,0 @@ | |||
| #create-operator-contact { | |||
| position: absolute; | |||
| right: 0; | |||
| top: -6rem; | |||
| } | |||
| @media only screen and (max-width: 1004px) { | |||
| #create-operator-contact { | |||
| position: relative; | |||
| right: auto; | |||
| top: auto; | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -1,176 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| import {IOperatorContact} from '../../../../model/entities/operator-contact'; | |||
| import {OperatorContactPersonDetailComponent} from '../operator-contact-person-detail/operator-contact-person-detail.component'; | |||
| import {OperatorContactPersonEditComponent} from '../operator-contact-person-edit/operator-contact-person-edit.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-contact-person-view', | |||
| templateUrl: './operator-contact-person-view.component.html', | |||
| styleUrls: ['./operator-contact-person-view.component.scss'] | |||
| }) | |||
| export class OperatorContactPersonViewComponent extends AgGridComponent implements OnInit { | |||
| @Output() createOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() editOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() deleteOperatorContact: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() shortcut: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('modalOperatorContactPersonEdit', { static: true }) modalOperatorContactPersonEdit: ModalComponent; | |||
| @ViewChild('operatorContactPersonEdit', { static: true }) operatorContactPersonEdit: OperatorContactPersonEditComponent; | |||
| @ViewChild('modalOperatorContactPersonDetail', { static: true }) modalOperatorContactPersonDetail: ModalComponent; | |||
| @ViewChild('operatorContactPersonDetail', { static: true }) operatorContactPersonDetail: OperatorContactPersonDetailComponent; | |||
| public operator: IOperator; | |||
| public operatorContacts: IOperatorContact[]; | |||
| public operatorContactsById: {}; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(private appService: AppService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.config = this.appService.getConfig(); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorContacts = []; | |||
| this.operatorContactsById = {}; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'Anrede', field: 'gender', width: 90 }, | |||
| {headerName: 'Vorname', field: 'firstname' }, | |||
| {headerName: 'Nachname', field: 'lastname' }, | |||
| {headerName: 'Abteilung', field: 'department' }, | |||
| {headerName: 'E-Mail Adresse', field: 'email', cellRenderer: this.emailRenderer }, | |||
| {headerName: 'Telefon', field: 'phone_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Mobil', field: 'mobile_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Fax', field: 'fax_no' }, | |||
| {headerName: 'Straße', field: 'street' }, | |||
| {headerName: 'Hausnummer', field: 'street_no' }, | |||
| {headerName: 'PLZ', field: 'zip' }, | |||
| {headerName: 'Ort', field: 'city' }, | |||
| {headerName: 'Land', field: 'country' }, | |||
| {headerName: 'Bemerkungen', field: 'comment' } | |||
| ]; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param isUpdate | |||
| */ | |||
| public setData(operator: IOperator, isUpdate: boolean): void { | |||
| this.operator = operator; | |||
| this.operatorContacts = this.operator.v_operator_contacts; | |||
| this.operatorContactsById = Utils.getSortedObjFromArray(this.operatorContacts, 'id'); | |||
| this.modalOperatorContactPersonEdit.closeModal(); | |||
| this.generateEntries(); | |||
| if (isUpdate) { | |||
| this.operatorContactPersonDetail.updateData(operator); | |||
| } else { | |||
| this.modalOperatorContactPersonDetail.closeModal(); | |||
| } | |||
| } | |||
| /** | |||
| * Generates AG grid entries | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| for (let i = 0; i < this.operatorContacts.length; i++) { | |||
| let ocGender: string; | |||
| if (this.operatorContacts[i].gender == 'male') { | |||
| ocGender = 'Herr'; | |||
| } else if (this.operatorContacts[i].gender == 'female') { | |||
| ocGender = 'Frau'; | |||
| } else { | |||
| ocGender = 'Divers'; | |||
| } | |||
| this.rowData.push({ | |||
| id: this.operatorContacts[i].id, | |||
| gender: ocGender, | |||
| firstname: this.operatorContacts[i].firstname, | |||
| lastname: this.operatorContacts[i].lastname, | |||
| department: this.operatorContacts[i].department, | |||
| email: this.operatorContacts[i].email, | |||
| phone_no: this.operatorContacts[i].phone_no, | |||
| mobile_no: this.operatorContacts[i].mobile_no, | |||
| fax_no: this.operatorContacts[i].fax_no, | |||
| street: this.operatorContacts[i].street, | |||
| street_no: this.operatorContacts[i].street_no, | |||
| zip: this.operatorContacts[i].zip, | |||
| city: this.operatorContacts[i].city, | |||
| country: !isNull(this.operatorContacts[i].country_id) ? this.config.vc_countries_by_id[this.operatorContacts[i].country_id].name : null, | |||
| comment: this.operatorContacts[i].comment, | |||
| }); | |||
| } | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalOperatorContactPersonDetail.openModal(); | |||
| this.operatorContactPersonDetail.setData(this.operator, Utils.deepClone(this.operatorContactsById[e.data.id]) as IOperatorContact); | |||
| } | |||
| /** | |||
| * On create click | |||
| */ | |||
| public create(): void { | |||
| this.modalOperatorContactPersonEdit.openModal(); | |||
| this.operatorContactPersonEdit.setData(Factory.getEmptyOperatorContact(this.operator.id)); | |||
| } | |||
| /** | |||
| * Creates operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public createOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.createOperatorContact.emit(operatorContact); | |||
| } | |||
| /** | |||
| * Edit operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public editOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.editOperatorContact.emit(operatorContact); | |||
| } | |||
| /** | |||
| * Deletes operator contact | |||
| * @param operatorId | |||
| */ | |||
| public deleteOperatorContactFunction(operatorId: number): void { | |||
| this.deleteOperatorContact.emit(operatorId); | |||
| } | |||
| /** | |||
| * Shortcut to operator detail | |||
| * @param operator | |||
| */ | |||
| public shortcutFunction(operator: IOperator): void { | |||
| this.modalOperatorContactPersonDetail.closeModal(); | |||
| this.shortcut.emit(operator); | |||
| } | |||
| } | |||
| @@ -1,120 +0,0 @@ | |||
| <h3 *ngIf="!isCreationMode">{{operator.name}} bearbeiten</h3> | |||
| <h3 *ngIf="isCreationMode">Betreiber anlegen</h3> | |||
| <form class="form" #operatorDataForm="ngForm" (ngSubmit)="onFormSubmit(operatorDataForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="odeName.invalid && odeName.touched && odeName?.errors?.required"> | |||
| Name ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern" class="error-msg"> | |||
| Bitte gültige E-Mail Adresse eingeben. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column column--checkbox"> | |||
| <p class="label">Aktivität</p> | |||
| <input type="checkbox" id="odeActive" name="odeActive" [(ngModel)]="operator.active" #odeActive="ngModel" /> | |||
| <label for="odeActive">Betreiber ist aktiv</label> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeName" [class.error]="odeName.touched && odeName?.errors?.required"><strong>Name*</strong></label> | |||
| <input type="text" id="odeName" name="odeName" [(ngModel)]="operator.name" required #odeName="ngModel" | |||
| placeholder="Musterfirma" [class.error]="odeName.touched && odeName?.errors?.required" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeAdditionalname">Zusatz</label> | |||
| <input type="text" id="odeAdditionalname" name="odeAdditionalname" [(ngModel)]="operator.name_additional" #odeAdditionalname="ngModel" | |||
| placeholder="Die Muster-Agentur"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeStreet">Straße</label> | |||
| <input type="text" id="odeStreet" name="odeStreet" [(ngModel)]="operator.street" | |||
| placeholder="Musterstraße" #odeStreet="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeStreetNo">Hausnummer</label> | |||
| <input type="text" id="odeStreetNo" name="odeStreetNo" [(ngModel)]="operator.street_no" | |||
| placeholder="1a" #odeStreetNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeZip">PLZ</label> | |||
| <input type="text" id="odeZip" name="odeZip" [(ngModel)]="operator.zip" | |||
| placeholder="12345" #odeZip="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeCity">Ort</label> | |||
| <input type="text" id="odeCity" name="odeCity" [(ngModel)]="operator.city" | |||
| placeholder="Musterstadt" #odeCity="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeCountry">Land</label> | |||
| <select id="odeCountry" name="odeCountry" [(ngModel)]="operator.country_id" #odeCountry="ngModel"> | |||
| <option [ngValue]=null>Land wählen</option> | |||
| <option *ngFor="let c of config.countries" value="{{ c.id }}">{{ c.name }}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeUrl">Internetadresse</label> | |||
| <input type="text" id="odeUrl" name="odeUrl" [(ngModel)]="operator.url" #odeUrl="ngModel" | |||
| placeholder="http://www.musterfirma.de"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeEmail" [class.error]="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern">E-Mail</label> | |||
| <input type="email" id="odeEmail" name="odeEmail" [(ngModel)]="operator.email" #odeEmail="ngModel" | |||
| [class.error]="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="odeComment" name="odeComment" [(ngModel)]="operator.comment" #odeComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odePhoneNo">Telefon</label> | |||
| <input type="text" id="odePhoneNo" name="odePhoneNo" [(ngModel)]="operator.phone_no" | |||
| placeholder="040-1234567" #odePhoneNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeMobileNo">Mobil</label> | |||
| <input type="text" id="odeMobileNo" name="odeMobileNo" [(ngModel)]="operator.mobile_no" | |||
| placeholder="0177-1234567" #odeMobileNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeFaxNo">Fax</label> | |||
| <input type="text" id="odeFaxNo" name="odeFaxNo" [(ngModel)]="operator.fax_no" | |||
| placeholder="040-1234568" #odeFaxNo="ngModel"/> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!operatorDataForm.valid" title="Betreiber speichern" *ngIf="!isCreationMode">speichern</button> | |||
| <button class="button" [disabled]="!operatorDataForm.valid" title="Betreiber anlegen" *ngIf="isCreationMode">anlegen</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,71 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {isNull} from 'util'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-data-edit', | |||
| templateUrl: './operator-data-edit.component.html', | |||
| styleUrls: ['./operator-data-edit.component.scss'] | |||
| }) | |||
| export class OperatorDataEditComponent extends FormComponent implements OnInit { | |||
| @Output() editOperator: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @Output() createOperator: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('operatorDataForm', { static: true }) operatorDataForm: NgForm; | |||
| public operator: IOperator; | |||
| public config: IConfig; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.config = this.appService.getConfig(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| */ | |||
| public setData(operator: IOperator): void { | |||
| this.operator = operator; | |||
| this.isCreationMode = isNull(this.operator.id); | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.operatorDataForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| if (this.isCreationMode) { | |||
| this.createOperator.emit(this.operator); | |||
| } else { | |||
| this.editOperator.emit(this.operator); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'operator-data-modal' : 'operator-data-edit-modal'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,38 +0,0 @@ | |||
| <h3>Betreiberdaten</h3> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Status:</dt> | |||
| <dd><span *ngIf="operator.active">Aktiv</span><span *ngIf="!operator.active">Inaktiv</span></dd> | |||
| <dt>Firma:</dt> | |||
| <dd>{{operator.name}}<ng-container *ngIf="operator.old_plp_id != null"> ({{operator.old_plp_id}})</ng-container></dd> | |||
| <dt *ngIf="operator.name_additional">Zusatz:</dt> | |||
| <dd *ngIf="operator.name_additional">{{operator.name_additional}}</dd> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{operator.street}} {{operator.street_no}}<br /> | |||
| {{operator.zip}} {{operator.city}} | |||
| <ng-container *ngIf="operator.country_id"><br />{{config.vc_countries_by_id[operator.country_id]['name']}}</ng-container></dd> | |||
| <dt *ngIf="checkedUrl">Internetadresse:</dt> | |||
| <dd *ngIf="checkedUrl"><a href="{{checkedUrl}}" target="_blank">{{checkedUrl}}</a></dd> | |||
| <dt *ngIf="operator.email">E-Mail:</dt> | |||
| <dd *ngIf="operator.email"><a href="mailto:{{operator.email}}">{{operator.email}}</a></dd> | |||
| <dt *ngIf="operator.phone_no">Telefon:</dt> | |||
| <dd *ngIf="operator.phone_no"><a href="tel:{{operator.phone_no}}">{{operator.phone_no}}</a></dd> | |||
| <dt *ngIf="operator.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="operator.mobile_no"><a href="tel:{{operator.mobile_no}}">{{operator.mobile_no}}</a></dd> | |||
| <dt *ngIf="operator.fax_no">Fax:</dt> | |||
| <dd *ngIf="operator.fax_no">{{operator.fax_no}}</dd> | |||
| <dt *ngIf="operator.comment">Bemerkung:</dt> | |||
| <dd class="pre-wrap" *ngIf="operator.comment">{{operator.comment}}</dd> | |||
| </dl> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="button button--inline right" (click)="edit()" *ngIf="hasEditRights">bearbeiten</div> | |||
| </div> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalOperatorDataEdit> | |||
| <div id="operator-data-edit-modal"> | |||
| <app-operator-data-edit #operatorDataEdit (editOperator)="editOperatorFunction($event)"></app-operator-data-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,65 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| import {OperatorDataEditComponent} from '../operator-data-edit/operator-data-edit.component'; | |||
| @Component({ | |||
| selector: 'app-operator-data-view', | |||
| templateUrl: './operator-data-view.component.html', | |||
| styleUrls: ['./operator-data-view.component.scss'] | |||
| }) | |||
| export class OperatorDataViewComponent implements OnInit { | |||
| @Output() editOperator: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('modalOperatorDataEdit', { static: true }) modalOperatorDataEdit: ModalComponent; | |||
| @ViewChild('operatorDataEdit', { static: true }) operatorDataEdit: OperatorDataEditComponent; | |||
| public operator: IOperator; | |||
| public checkedUrl: string; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(private appService: AppService) { } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.config = this.appService.getConfig(); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.checkedUrl = ''; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| */ | |||
| public setData(operator: IOperator): void { | |||
| this.operator = operator; | |||
| this.checkedUrl = Utils.checkUrl(this.operator.url); | |||
| this.modalOperatorDataEdit.closeModal(); | |||
| } | |||
| /** | |||
| * On edit click | |||
| */ | |||
| public edit(): void { | |||
| this.modalOperatorDataEdit.openModal(); | |||
| this.operatorDataEdit.setData(Utils.deepClone(this.operator) as IOperator); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param operator | |||
| */ | |||
| public editOperatorFunction(operator: IOperator): void { | |||
| this.editOperator.emit(operator); | |||
| } | |||
| } | |||
| @@ -1,77 +0,0 @@ | |||
| <div [hidden]="isEditMode"> | |||
| <h3>Termin mit Betreiber: {{operator.name}}</h3> | |||
| <h4>{{date}} {{timeStart}} Uhr bis {{timeEnd}} Uhr</h4> | |||
| <h3>{{operatorMeeting.title}}</h3> | |||
| <h5>Erstellt von: {{creator.firstname}} {{creator.lastname}}</h5> | |||
| <p *ngIf="operatorMeeting.description">{{operatorMeeting.description}}</p> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Termin-Art:</dt> | |||
| <dd>{{meetingType.name}}</dd> | |||
| <dt>PLP Verantwortlicher:</dt> | |||
| <dd>{{owner.firstname}} {{owner.lastname}}</dd> | |||
| <dt>Teilnehmer:</dt> | |||
| <dd> | |||
| <ng-container *ngFor="let p of participants"> | |||
| {{p.firstname}} {{p.lastname}}<br /> | |||
| </ng-container> | |||
| </dd> | |||
| <ng-container *ngIf="meetingType.type == 'visit'"> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{operatorMeeting.street}} {{operatorMeeting.street_no}}<br /> | |||
| {{operatorMeeting.zip}} {{operatorMeeting.city}} | |||
| <ng-container *ngIf="operatorMeeting.country_id != null"><br />{{config.vc_countries_by_id[operatorMeeting.country_id]['name']}}</ng-container></dd> | |||
| </ng-container> | |||
| <dt>Gesprächspartner:</dt> | |||
| <dd><span *ngIf="operatorMeeting.gender == 'male'">Herr </span> | |||
| <span *ngIf="operatorMeeting.gender == 'female'">Frau </span> | |||
| <span *ngIf="operatorMeeting.gender == 'diverse'">Divers </span>{{operatorMeeting.firstname}} {{operatorMeeting.lastname}}</dd> | |||
| <dt *ngIf="operatorMeeting.department">Abteilung:</dt> | |||
| <dd *ngIf="operatorMeeting.department">{{operatorMeeting.department}}</dd> | |||
| <dt *ngIf="operatorMeeting.email">E-Mail:</dt> | |||
| <dd *ngIf="operatorMeeting.email"><a href="mailto:{{operatorMeeting.email}}">{{operatorMeeting.email}}</a></dd> | |||
| <dt *ngIf="operatorMeeting.phone_no">Telefon:</dt> | |||
| <dd *ngIf="operatorMeeting.phone_no"><a href="tel:{{operatorMeeting.phone_no}}">{{operatorMeeting.phone_no}}</a></dd> | |||
| <dt *ngIf="operatorMeeting.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="operatorMeeting.mobile_no"><a href="tel:{{operatorMeeting.mobile_no}}">{{operatorMeeting.mobile_no}}</a></dd> | |||
| <dt *ngIf="reportOld != null && reportOld != ''">Report:</dt> | |||
| <dd *ngIf="reportOld != null && reportOld != ''">{{reportOld}}</dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="form"*ngIf="hasAdminRights"> | |||
| <div class="row row--last"> | |||
| <div class="column"> | |||
| <div class="button button--inline" (click)="editEntry()" *ngIf="operatorMeeting.v_is_editable">Eintrag bearbeiten</div> | |||
| <div class="button button--inline" (click)="deleteEntry()" *ngIf="operatorMeeting.v_is_editable">Eintrag löschen</div> | |||
| <div class="button button--inline" (click)="editReport()" *ngIf="!reportFormVisible">Report bearbeiten</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="operator-meeting-edit-report" *ngIf="hasAdminRights || appService.getAppUser().id == operatorMeeting.owner_user_id"> | |||
| <form class="form" #operatorMeetingReportForm="ngForm" (ngSubmit)="onFormSubmit(operatorMeetingReportForm)" *ngIf="reportFormVisible"> | |||
| <div *ngIf="errorMsg != ''" class="row row--full"> | |||
| <p class="error">{{ errorMsg }}</p> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmdReport">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="cmdReport" name="cmdReport" [(ngModel)]="operatorMeeting.report" #cmdReport="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!operatorMeetingReportForm.valid" title="Report speichern">Report speichern</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| <div [hidden]="!isEditMode"> | |||
| <div id="operator-meeting-edit-modal"> | |||
| <app-operator-meeting-edit #operatorMeetingDetailEdit (editMeeting)="editOperatorMeetingFunction($event)"></app-operator-meeting-edit> | |||
| </div> | |||
| </div> | |||
| @@ -1,203 +0,0 @@ | |||
| import { | |||
| ChangeDetectionStrategy, | |||
| ChangeDetectorRef, | |||
| Component, | |||
| EventEmitter, | |||
| OnInit, | |||
| Output, | |||
| ViewChild | |||
| } from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IUser} from '../../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {MeetingService} from '../../../../services/meeting.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {isNull} from 'util'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperatorMeeting} from '../../../../model/entities/operator-meeting'; | |||
| import {OperatorMeetingEditComponent} from '../operator-meeting-edit/operator-meeting-edit.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| import {OperatorService} from '../../../../services/operator.service'; | |||
| @Component({ | |||
| selector: 'app-operator-meeting-detail', | |||
| templateUrl: './operator-meeting-detail.component.html', | |||
| styleUrls: ['./operator-meeting-detail.component.scss'], | |||
| // NOTE: We need manual change detection in this component | |||
| changeDetection: ChangeDetectionStrategy.OnPush, | |||
| }) | |||
| export class OperatorMeetingDetailComponent extends FormComponent implements OnInit { | |||
| @Output() editMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() deleteMeeting: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() editMeetingReport: EventEmitter<any> = new EventEmitter<any>(); | |||
| @ViewChild('operatorMeetingDetailEdit', { static: true }) operatorMeetingDetailEdit: OperatorMeetingEditComponent; | |||
| @ViewChild('operatorMeetingReportForm', { static: true }) operatorMeetingReportForm: NgForm; | |||
| public operator: IOperator; | |||
| public operatorMeeting: IOperatorMeeting; | |||
| public isEditMode: boolean; | |||
| public creator: IUser; | |||
| public owner: IUser; | |||
| public participants: IUser[]; | |||
| public meetingType: IMeetingType; | |||
| public date: string; | |||
| public timeStart: string; | |||
| public timeEnd: string; | |||
| public config: IConfig; | |||
| public reportFormVisible: boolean; | |||
| public reportOld: string; | |||
| public hasAdminRights: boolean; | |||
| constructor( | |||
| public appService: AppService, | |||
| private operatorService: OperatorService, | |||
| private meetingService: MeetingService, | |||
| protected scrollToService: ScrollToService, | |||
| private ref: ChangeDetectorRef | |||
| ) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.hasAdminRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||
| this.config = this.appService.getConfig(); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorMeeting = Factory.getEmptyOperatorMeeting(); | |||
| this.creator = Factory.getEmptyUser(); | |||
| this.owner = Factory.getEmptyUser(); | |||
| this.participants = []; | |||
| this.meetingType = Factory.getEmptyMeetingType(); | |||
| this.date = ''; | |||
| this.timeStart = ''; | |||
| this.timeEnd = ''; | |||
| this.reportFormVisible = false; | |||
| this.reportOld = ''; | |||
| } | |||
| /** | |||
| * Set data | |||
| * @param operator | |||
| * @param operatorMeeting | |||
| */ | |||
| public setData(operator: IOperator, operatorMeeting: IOperatorMeeting): void { | |||
| this.operator = operator; | |||
| this.operatorMeeting = operatorMeeting; | |||
| this.setMeetingData(); | |||
| } | |||
| /** | |||
| * Updates data | |||
| * @param operator | |||
| */ | |||
| public updateData(operator: IOperator): void { | |||
| this.operator = operator; | |||
| if (!isNull(this.operatorMeeting.id)) { | |||
| for (let i = 0; i < this.operator.v_operator_meetings.length; i++) { | |||
| if (this.operator.v_operator_meetings[i].id == this.operatorMeeting.id) { | |||
| this.operatorMeeting = this.operator.v_operator_meetings[i]; | |||
| } | |||
| } | |||
| this.setMeetingData(); | |||
| } | |||
| } | |||
| /** | |||
| * Sets variables for meeting | |||
| */ | |||
| public setMeetingData() { | |||
| this.errorMsg = ''; | |||
| this.reportFormVisible = false; | |||
| this.reportOld = this.operatorMeeting.report; | |||
| this.creator = this.appService.getConfig().vc_user_by_id[this.operatorMeeting.creation_user_id]; | |||
| this.owner = this.appService.getConfig().vc_user_by_id[this.operatorMeeting.owner_user_id]; | |||
| this.participants = []; | |||
| for (let i = 0; i < this.operatorMeeting.v_participants.length; i++) { | |||
| this.participants.push(this.appService.getConfig().vc_user_by_id[this.operatorMeeting.v_participants[i].participant_user_id]); | |||
| } | |||
| this.meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.operatorMeeting.meeting_type_id]; | |||
| this.date = Utils.getDateTimeToDisplay(this.operatorMeeting.start_date); | |||
| this.timeStart = Utils.getDateTimeToDisplay(this.operatorMeeting.start_date, false, true); | |||
| this.timeEnd = Utils.getDateTimeToDisplay(this.operatorMeeting.end_date, false, true); | |||
| this.isEditMode = false; | |||
| this.resetFormValidation(); | |||
| // NOTE: We need manual change detection in this component | |||
| this.ref.detectChanges(); | |||
| } | |||
| /** | |||
| * Edit meeting entry | |||
| */ | |||
| public editEntry(): void { | |||
| this.isEditMode = true; | |||
| this.operatorMeetingDetailEdit.setData(this.operator, Utils.deepClone(this.operatorMeeting) as IOperatorMeeting); | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param operatorMeeting | |||
| */ | |||
| public editOperatorMeetingFunction(operatorMeeting: IOperatorMeeting) { | |||
| this.editMeeting.emit(operatorMeeting); | |||
| } | |||
| /** | |||
| * Delete meeting entry | |||
| */ | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Eintrag wirklich löschen?'); | |||
| if (confirmAction == true) { | |||
| this.deleteMeeting.emit(this.operatorMeeting.id); | |||
| } | |||
| } | |||
| /** | |||
| * Check if edit report after meeting has started | |||
| */ | |||
| public editReport(): void { | |||
| this.meetingService.apiCheckOperatorMeetingReport(this.operatorMeeting.id).subscribe( | |||
| data => { | |||
| this.reportFormVisible = data.result_data as boolean; | |||
| // NOTE: We need manual change detection in this component | |||
| this.ref.detectChanges(); | |||
| this.scrollUp('operator-meeting-edit-report'); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| if (this.reportFormVisible) { | |||
| this.operatorMeetingReportForm.form.markAsUntouched(); | |||
| } | |||
| } | |||
| /** | |||
| * Saves operator meeting report | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| this.editMeetingReport.emit({ | |||
| id: this.operatorMeeting.id, | |||
| report: this.operatorMeeting.report | |||
| }); | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp('operator-meeting-edit-report'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,200 +0,0 @@ | |||
| <h3 *ngIf="isCreationMode">Kunden-Termin anlegen</h3> | |||
| <h3 *ngIf="!isCreationMode">Kunden-Termin bearbeiten</h3> | |||
| <form class="form" #operatorMeetingForm="ngForm" (ngSubmit)="onFormSubmit(operatorMeetingForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="cmeTitle.invalid && cmeTitle.touched && cmeTitle?.errors?.required"> | |||
| Betreff ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="cmeDate.invalid && cmeDate.touched && cmeDate?.errors?.required" class="error-msg"> | |||
| Datum ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="cmeTimeStart.invalid && cmeTimeStart.touched && cmeTimeStart?.errors?.required" class="error-msg"> | |||
| Uhrzeit (Start) ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="cmeTimeEnd.invalid && cmeTimeEnd.touched && cmeTimeEnd?.errors?.required" class="error-msg"> | |||
| Uhrzeit (Ende) ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="cmeMeetingType.invalid && cmeMeetingType.touched && cmeMeetingType?.errors?.required" class="error-msg"> | |||
| Termin-Art ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="cmeOwner.invalid && cmeOwner.touched && cmeOwner?.errors?.required" class="error-msg"> | |||
| PLP Verantwortlicher ist ein Pflichtfeld. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeTitle" [class.error]="cmeTitle.invalid && cmeTitle.touched && cmeTitle?.errors?.required"><strong>Betreff*</strong></label> | |||
| <input type="text" [class.error]="cmeTitle.invalid && cmeTitle.touched && cmeTitle?.errors?.required" id="cmeTitle" name="cmeTitle" required [(ngModel)]="operatorMeeting.title" | |||
| placeholder="Betreff" #cmeTitle="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeDate" [class.error]="cmeDate.invalid && cmeDate.touched && cmeDate?.errors?.required"><strong>Datum*</strong></label> | |||
| <input type="date" [class.error]="cmeDate.invalid && cmeDate.touched && cmeDate?.errors?.required" id="cmeDate" name="cmeDate" required [(ngModel)]="startDate" | |||
| (blur)="checkDate($event)" #cmeDate="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeTimeStart" [class.error]="cmeTimeStart.invalid && cmeTimeStart.touched && cmeTimeStart?.errors?.required"><strong>Uhrzeit (Start)*</strong></label> | |||
| <input type="time" [class.error]="cmeTimeStart.invalid && cmeTimeStart.touched && cmeTimeStart?.errors?.required" id="cmeTimeStart" name="cmeTimeStart" required [(ngModel)]="timeStart" | |||
| #cmeTimeStart="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeTimeEnd" [class.error]="cmeTimeEnd.invalid && cmeTimeEnd.touched && cmeTimeEnd?.errors?.required"><strong>Uhrzeit (Ende)*</strong></label> | |||
| <input type="time" [class.error]="cmeTimeEnd.invalid && cmeTimeEnd.touched && cmeTimeEnd?.errors?.required" id="cmeTimeEnd" name="cmeTimeEnd" required [(ngModel)]="timeEnd" | |||
| #cmeTimeEnd="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeMeetingType" [class.error]="cmeMeetingType.invalid && cmeMeetingType.touched && cmeMeetingType?.errors?.required"><strong>Termin-Art*</strong></label> | |||
| <select id="cmeMeetingType" [class.error]="cmeMeetingType.invalid && cmeMeetingType.touched && cmeMeetingType?.errors?.required" name="cmeMeetingType" required (change)="selectMeetingType($event)" [(ngModel)]="operatorMeeting.meeting_type_id" #cmeMeetingType="ngModel"> | |||
| <option [ngValue]=null>Bitte Termin-Art wählen</option> | |||
| <option *ngFor="let m of meetingTypes" value="{{m.id}}">{{m.name}}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"> | |||
| </div> | |||
| </div> | |||
| <ng-container *ngIf="operatorMeeting.meeting_type_id == 2"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeStreet">Straße</label> | |||
| <input type="text" id="cmeStreet" name="cmeStreet" [(ngModel)]="operatorMeeting.street" | |||
| placeholder="Musterstraße" #cmeStreet="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeStreetNo">Hausnummer</label> | |||
| <input type="text" id="cmeStreetNo" name="cmeStreetNo" [(ngModel)]="operatorMeeting.street_no" | |||
| placeholder="1a" #cmeStreetNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeZip">PLZ</label> | |||
| <input type="text" id="cmeZip" name="cmeZip" [(ngModel)]="operatorMeeting.zip" | |||
| placeholder="12345" #cmeZip="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeCity">Ort</label> | |||
| <input type="text" id="cmeCity" name="cmeCity" [(ngModel)]="operatorMeeting.city" | |||
| placeholder="Musterstadt" #cmeCity="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeCountry">Land</label> | |||
| <select id="cmeCountry" name="cmeCountry" [(ngModel)]="operatorMeeting.country_id" #cmeCountry="ngModel"> | |||
| <option [ngValue]=null>Land wählen</option> | |||
| <option *ngFor="let c of config.countries" value="{{ c.id }}">{{ c.name }}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| </ng-container> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="cmeComment" name="cmeComment" [(ngModel)]="operatorMeeting.description" #cmeComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeOwner" [class.error]="cmeOwner.invalid && cmeOwner.touched && cmeOwner?.errors?.required"><strong>PLP Verantwortlicher*</strong></label> | |||
| <select id="cmeOwner" [class.error]="cmeOwner.invalid && cmeOwner.touched && cmeOwner?.errors?.required" name="cmeOwner" required (change)="selectOwner($event)" [(ngModel)]="operatorMeeting.owner_user_id" #cmeOwner="ngModel"> | |||
| <option [ngValue]=null>Bitte Verantwortlichen wählen</option> | |||
| <option *ngFor="let u of possibleOwners" value="{{u.id}}">{{u.firstname}} {{u.lastname}}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <p class="label">Teilnehmer</p> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column column--checkbox"> | |||
| <div class="checkbox-inner-column" *ngFor="let p of participants; let i = index"> | |||
| <input type="checkbox" id="cmeParticipants{{i}}" name="cmeParticipants{{i}}" | |||
| (change)="participantsChange($event)" [value]="p.id" [checked]="checkParticipants(p.id)" /> | |||
| <label for="cmeParticipants{{i}}">{{p.firstname}} {{p.lastname}}</label> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeContactPerson">Gesprächspartner</label> | |||
| <select id="cmeContactPerson" name="cmeContactPerson" (change)="selectContact($event)" [(ngModel)]="operatorMeeting.operator_contact_id"> | |||
| <option value="-1">Kein Gesprächspartner</option> | |||
| <option value="0">- Individuell -</option> | |||
| <option *ngFor="let c of operatorContacts" value="{{c.id}}">{{c.firstname}} {{c.lastname}}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"> | |||
| <div *ngIf="operatorMeeting.operator_contact_id != -1"> | |||
| <label for="cmeGender">Anrede</label> | |||
| <select id="cmeGender" name="cmeGender" [(ngModel)]="operatorMeeting.gender" #cmeGender="ngModel" [disabled]="isExistingOperatorContact" > | |||
| <option [ngValue]=null>Anrede wählen</option> | |||
| <option value="male">Herr</option> | |||
| <option value="female">Frau</option> | |||
| <option value="diverse">Divers</option> | |||
| </select> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div *ngIf="operatorMeeting.operator_contact_id != -1"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeFirstname">Vorname</label> | |||
| <input type="text" id="cmeFirstname" name="cmeFirstname" [(ngModel)]="operatorMeeting.firstname" #cmeFirstname="ngModel" | |||
| placeholder="Brigitte" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeLastname">Nachname</label> | |||
| <input type="text" id="cmeLastname" name="cmeLastname" [(ngModel)]="operatorMeeting.lastname" | |||
| #cmeLastname="ngModel" placeholder="Mustermann" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmeDepartment">Abteilung</label> | |||
| <input type="text" id="cmeDepartment" name="cmeDepartment" [(ngModel)]="operatorMeeting.department" #cmeDepartment="ngModel" | |||
| placeholder="Marketing" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeEmail">E-Mail</label> | |||
| <input type="email" id="cmeEmail" name="cmeEmail" [(ngModel)]="operatorMeeting.email" #cmeEmail="ngModel" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmePhoneNo">Telefon</label> | |||
| <input type="text" id="cmePhoneNo" name="cmePhoneNo" [(ngModel)]="operatorMeeting.phone_no" #cmePhoneNo="ngModel" | |||
| placeholder="040-1234567" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cmeMobileNo">Mobil</label> | |||
| <input type="text" id="cmeMobileNo" name="cmeMobileNo" [(ngModel)]="operatorMeeting.mobile_no" #cmeMobileNo="ngModel" | |||
| placeholder="0177-1234567" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button *ngIf="isCreationMode" [disabled]="!operatorMeetingForm.valid" class="button" title="Termin anlegen">Termin anlegen</button> | |||
| <button *ngIf="!isCreationMode" [disabled]="!operatorMeetingForm.valid" class="button" title="Termin bearbeiten">Termin bearbeiten</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,261 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IUser} from '../../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| import {IOperatorMeeting} from '../../../../model/entities/operator-meeting'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| import {IOperatorContact} from '../../../../model/entities/operator-contact'; | |||
| @Component({ | |||
| selector: 'app-operator-meeting-edit', | |||
| templateUrl: './operator-meeting-edit.component.html', | |||
| styleUrls: ['./operator-meeting-edit.component.scss'] | |||
| }) | |||
| export class OperatorMeetingEditComponent extends FormComponent implements OnInit { | |||
| @Output() createMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() editMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @ViewChild('operatorMeetingForm', { static: true }) operatorMeetingForm: NgForm; | |||
| public operator: IOperator; | |||
| public operatorMeeting: IOperatorMeeting; | |||
| public operatorContacts: IOperatorContact[]; | |||
| public operatorContactsById: {}; | |||
| public isExistingOperatorContact: boolean; | |||
| public users: IUser[]; | |||
| public usersById: {}; | |||
| public possibleOwners: IUser[]; | |||
| public participants: IUser[]; | |||
| public selectedParticipantsById: {}; | |||
| public selectedParticipantsByIdInitial: {}; | |||
| public owner: IUser; | |||
| public startDate: string; | |||
| public timeStart: string; | |||
| public timeEnd: string; | |||
| public meetingTypes: IMeetingType[]; | |||
| public contactPersonValue: string; | |||
| public config: IConfig; | |||
| constructor(public appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.config = this.appService.getConfig(); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorMeeting = Factory.getEmptyOperatorMeeting(); | |||
| this.operatorContacts = []; | |||
| this.operatorContactsById = {}; | |||
| this.isExistingOperatorContact = false; | |||
| this.users = []; | |||
| this.usersById = {}; | |||
| this.possibleOwners = []; | |||
| this.participants = []; | |||
| this.selectedParticipantsById = {}; | |||
| this.selectedParticipantsByIdInitial = {}; | |||
| this.owner = Factory.getEmptyUser(); | |||
| this.startDate = ''; | |||
| this.timeStart = ''; | |||
| this.timeEnd = ''; | |||
| this.meetingTypes = []; | |||
| this.contactPersonValue = ''; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param operatorMeeting | |||
| * @param isCreationMode | |||
| */ | |||
| public setData(operator: IOperator, operatorMeeting: IOperatorMeeting, isCreationMode: boolean = false): void { | |||
| this.operator = operator; | |||
| this.operatorMeeting = operatorMeeting; | |||
| this.operatorContacts = this.operator.v_operator_contacts; | |||
| this.operatorContactsById = Utils.getSortedObjFromArray(this.operatorContacts, 'id'); | |||
| this.isCreationMode = isCreationMode; | |||
| this.users = this.appService.getConfig().users; | |||
| this.owner = this.operatorMeeting.owner_user_id !== null ? | |||
| this.appService.getConfig().vc_user_by_id[this.operatorMeeting.owner_user_id] : null; | |||
| this.startDate = Utils.getDateTimeToDisplay(this.operatorMeeting.start_date, true, false, false, true); | |||
| this.timeStart = Utils.getDateTimeToDisplay(this.operatorMeeting.start_date, false, true); | |||
| this.timeEnd = Utils.getDateTimeToDisplay(this.operatorMeeting.end_date, false, true); | |||
| this.meetingTypes = this.appService.getConfig().meeting_types; | |||
| this.selectedParticipantsById = Utils.getSortedObjFromArray(this.operatorMeeting.v_participants, 'participant_user_id'); | |||
| this.selectedParticipantsByIdInitial = Utils.getSortedObjFromArray(this.operatorMeeting.v_participants, 'participant_user_id'); | |||
| this.participants = []; | |||
| this.usersById = Utils.getSortedObjFromArray(this.appService.getConfig().users, 'id'); | |||
| for (const p in this.usersById) { | |||
| if (this.isCreationMode) { | |||
| // New meeting | |||
| if (this.usersById[p].active) { | |||
| this.participants.push(this.usersById[p]); | |||
| this.possibleOwners.push(this.usersById[p]); | |||
| } | |||
| } else { | |||
| // Existing meeting | |||
| const userAttendsToMeeting: boolean = this.selectedParticipantsByIdInitial.hasOwnProperty(this.usersById[p].id); | |||
| if (this.usersById[p].id !== this.owner.id && (this.usersById[p].active || userAttendsToMeeting)) { | |||
| this.participants.push(this.usersById[p]); | |||
| this.possibleOwners.push(this.usersById[p]); | |||
| } | |||
| if (this.usersById[p].id === this.owner.id) { | |||
| this.possibleOwners.push(this.usersById[p]); | |||
| } | |||
| } | |||
| } | |||
| if (isNull(this.operatorMeeting.operator_contact_id)) { | |||
| this.operatorMeeting.operator_contact_id = -1; | |||
| } | |||
| if (this.operatorMeeting.operator_contact_id > 0) { | |||
| this.isExistingOperatorContact = true; | |||
| } | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * On select contact | |||
| * @param e | |||
| */ | |||
| public selectContact(e: any) { | |||
| this.operatorMeeting.operator_contact_id = e.target.value; | |||
| this.isExistingOperatorContact = false; | |||
| this.operatorMeeting.gender = null; | |||
| this.operatorMeeting.firstname = null; | |||
| this.operatorMeeting.lastname = null; | |||
| this.operatorMeeting.department = null; | |||
| this.operatorMeeting.email = null; | |||
| this.operatorMeeting.phone_no = null; | |||
| this.operatorMeeting.mobile_no = null; | |||
| if (this.operatorMeeting.operator_contact_id > 0) { | |||
| this.operatorMeeting.gender = this.operatorContactsById[this.operatorMeeting.operator_contact_id].gender; | |||
| this.operatorMeeting.firstname = this.operatorContactsById[this.operatorMeeting.operator_contact_id].firstname; | |||
| this.operatorMeeting.lastname = this.operatorContactsById[this.operatorMeeting.operator_contact_id].lastname; | |||
| this.operatorMeeting.department = this.operatorContactsById[this.operatorMeeting.operator_contact_id].department; | |||
| this.operatorMeeting.email = this.operatorContactsById[this.operatorMeeting.operator_contact_id].email; | |||
| this.operatorMeeting.phone_no = this.operatorContactsById[this.operatorMeeting.operator_contact_id].phone_no; | |||
| this.operatorMeeting.mobile_no = this.operatorContactsById[this.operatorMeeting.operator_contact_id].mobile_no; | |||
| this.isExistingOperatorContact = true; | |||
| } | |||
| } | |||
| /** | |||
| * On select owner | |||
| * @param e | |||
| */ | |||
| public selectOwner(e: any) { | |||
| if (e.target.value !== '0: null') { | |||
| this.owner = this.usersById[e.target.value]; | |||
| if (this.selectedParticipantsById.hasOwnProperty(this.owner.id)) { | |||
| delete this.selectedParticipantsById[this.owner.id]; | |||
| } | |||
| } else { | |||
| this.owner = null; | |||
| } | |||
| this.participants = []; | |||
| for (const p in this.usersById) { | |||
| if ((this.owner == null || this.usersById[p].id !== this.owner.id) && this.usersById[p].active) { | |||
| this.participants.push(this.usersById[p]); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * On select meeting type | |||
| * @param e | |||
| */ | |||
| public selectMeetingType(e: any) { | |||
| this.operatorMeeting.meeting_type_id = e.target.value; | |||
| } | |||
| /** | |||
| * On select participant | |||
| * @param e | |||
| */ | |||
| public participantsChange(e: any) { | |||
| const participantUserId: number = parseInt(e.target.value); | |||
| if (this.selectedParticipantsById.hasOwnProperty(participantUserId)) { | |||
| delete this.selectedParticipantsById[participantUserId]; | |||
| } else { | |||
| let myId: number = null; | |||
| if (this.selectedParticipantsByIdInitial.hasOwnProperty(participantUserId)) { | |||
| myId = this.selectedParticipantsByIdInitial[participantUserId].id; | |||
| } | |||
| this.selectedParticipantsById[participantUserId] = { | |||
| id: myId, | |||
| operator_meeting_id: this.operatorMeeting.id, | |||
| participant_user_id: participantUserId | |||
| }; | |||
| } | |||
| } | |||
| /** | |||
| * Checks if participant is selected | |||
| * @param id | |||
| */ | |||
| public checkParticipants(id: number) { | |||
| return this.selectedParticipantsById.hasOwnProperty(id); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.operatorMeetingForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves operator meeting | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| const identifier: string = this.isCreationMode ? 'operator-meeting-modal' : 'operator-meeting-edit-modal'; | |||
| if (valid) { | |||
| // Check if start time before end time | |||
| if (parseInt(this.timeStart.replace(/\:/g, '')) - parseInt(this.timeEnd.replace(/\:/g, '')) > 0) { | |||
| this.errorMsg = 'Zeit (Ende) darf nicht vor Zeit (Start) liegen.'; | |||
| this.scrollUp(identifier); | |||
| } else { | |||
| this.operatorMeeting.start_date = this.startDate + ' ' + this.timeStart + ':00'; | |||
| this.operatorMeeting.end_date = this.startDate + ' ' + this.timeEnd + ':00'; | |||
| // Check if date is valid | |||
| if (Utils.isValidDate(this.operatorMeeting.start_date)) { | |||
| this.operatorMeeting.v_participants = []; | |||
| for (const spId in this.selectedParticipantsById) { | |||
| this.operatorMeeting.v_participants.push(this.selectedParticipantsById[spId]); | |||
| } | |||
| if (this.operatorMeeting.operator_contact_id == -1) { | |||
| this.operatorMeeting.operator_contact_id = null; | |||
| } | |||
| if (this.isCreationMode) { | |||
| this.createMeeting.emit(this.operatorMeeting); | |||
| } else { | |||
| this.editMeeting.emit(this.operatorMeeting); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(identifier); | |||
| } | |||
| } | |||
| } else { | |||
| this.scrollUp(identifier); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,33 +0,0 @@ | |||
| <h3>Termine</h3> | |||
| <div class="button" id="create-operator-meeting" (click)="create()" *ngIf="hasAdminRights">Termin hinzufügen</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Termin suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [enableCellTextSelection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalOperatorMeetingDetail> | |||
| <app-operator-meeting-detail #operatorMeetingDetail (editMeeting)="editOperatorMeetingFunction($event)" | |||
| (deleteMeeting)="deleteOperatorMeetingFunction($event)" | |||
| (editMeetingReport)="editOperatorMeetingReportFunction($event)"></app-operator-meeting-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalOperatorMeetingEdit> | |||
| <div id="operator-meeting-modal"> | |||
| <app-operator-meeting-edit #operatorMeetingEdit (createMeeting)="createOperatorMeetingFunction($event)"></app-operator-meeting-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,14 +0,0 @@ | |||
| #create-operator-meeting { | |||
| position: absolute; | |||
| right: 0; | |||
| top: -6rem; | |||
| } | |||
| @media only screen and (max-width: 1004px) { | |||
| #create-operator-meeting { | |||
| position: relative; | |||
| right: auto; | |||
| top: auto; | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -1,199 +0,0 @@ | |||
| import {Component, EventEmitter, OnDestroy, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {IUser} from '../../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| import {IOperatorMeeting} from '../../../../model/entities/operator-meeting'; | |||
| import {OperatorMeetingEditComponent} from '../operator-meeting-edit/operator-meeting-edit.component'; | |||
| import {OperatorMeetingDetailComponent} from '../operator-meeting-detail/operator-meeting-detail.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-meeting-view', | |||
| templateUrl: './operator-meeting-view.component.html', | |||
| styleUrls: ['./operator-meeting-view.component.scss'] | |||
| }) | |||
| export class OperatorMeetingViewComponent extends AgGridComponent implements OnInit, OnDestroy { | |||
| @Output() createMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() editMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() deleteMeeting: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() editMeetingReport: EventEmitter<any> = new EventEmitter<any>(); | |||
| @ViewChild('modalOperatorMeetingEdit', {static: true}) modalOperatorMeetingEdit: ModalComponent; | |||
| @ViewChild('operatorMeetingEdit', {static: true}) operatorMeetingEdit: OperatorMeetingEditComponent; | |||
| @ViewChild('modalOperatorMeetingDetail', {static: true}) modalOperatorMeetingDetail: ModalComponent; | |||
| @ViewChild('operatorMeetingDetail', {static: true}) operatorMeetingDetail: OperatorMeetingDetailComponent; | |||
| public operator: IOperator; | |||
| public operatorMeeting: IOperatorMeeting[]; | |||
| public operatorMeetingEntriesById: {}; | |||
| public owner: IUser; | |||
| public participants: IUser[]; | |||
| public meetingType: IMeetingType; | |||
| public date: string; | |||
| public timeStart: string; | |||
| public timeEnd: string; | |||
| public hasAdminRights: boolean; | |||
| constructor(public appService: AppService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasAdminRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorMeeting = []; | |||
| this.operatorMeetingEntriesById = {}; | |||
| this.owner = Factory.getEmptyUser(); | |||
| this.participants = []; | |||
| this.meetingType = Factory.getEmptyMeetingType(); | |||
| this.date = ''; | |||
| this.timeStart = ''; | |||
| this.timeEnd = ''; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'Datum', field: 'date', cellRenderer: this.dateRenderer, comparator: this.dateComparator}, | |||
| {headerName: 'Ersteller', field: 'creator' }, | |||
| {headerName: 'PLP Verantwortlicher', field: 'owner'}, | |||
| {headerName: 'Gesprächspartner', field: 'operatorContactName'}, | |||
| {headerName: 'Titel', field: 'title'}, | |||
| {headerName: 'Uhrzeit (Start)', field: 'time_start', cellRenderer: this.timeRenderer}, | |||
| {headerName: 'Uhrzeit (Ende)', field: 'time_end', cellRenderer: this.timeRenderer}, | |||
| {headerName: 'Termin-Art', field: 'type'}, | |||
| {headerName: 'Adresse', field: 'address', cellRenderer: this.addressRenderer, autoHeight: true}, | |||
| { | |||
| headerName: 'Teilnehmer', | |||
| field: 'participants', | |||
| cellRenderer: this.participantsRenderer, | |||
| autoHeight: true | |||
| }, | |||
| {headerName: 'Abteilung', field: 'department'}, | |||
| {headerName: 'E-Mail', field: 'email'}, | |||
| {headerName: 'Telefon', field: 'phone'}, | |||
| {headerName: 'Mobil', field: 'mobile'}, | |||
| ]; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param isUpdate | |||
| */ | |||
| public setData(operator: IOperator, isUpdate: boolean): void { | |||
| this.operator = operator; | |||
| this.operatorMeeting = this.operator.v_operator_meetings; | |||
| this.operatorMeetingEntriesById = Utils.getSortedObjFromArray(this.operatorMeeting, 'id'); | |||
| this.modalOperatorMeetingEdit.closeModal(); | |||
| this.generateEntries(); | |||
| if (isUpdate) { | |||
| this.operatorMeetingDetail.updateData(operator); | |||
| } else { | |||
| this.modalOperatorMeetingDetail.closeModal(); | |||
| } | |||
| } | |||
| /** | |||
| * Generates AG grid entries | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| const items: {}[] = []; | |||
| for (let i = 0; i < this.operatorMeeting.length; i++) { | |||
| this.owner = this.appService.getConfig().vc_user_by_id[this.operatorMeeting[i].owner_user_id]; | |||
| this.meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.operatorMeeting[i].meeting_type_id]; | |||
| let operatorContactName: string = !isNull(this.operatorMeeting[i].firstname) ? this.operatorMeeting[i].firstname + ' ' : ''; | |||
| operatorContactName += !isNull(this.operatorMeeting[i].lastname) ? this.operatorMeeting[i].lastname : ''; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.operatorMeeting[i].creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| id: this.operatorMeeting[i].id, | |||
| title: this.operatorMeeting[i].title, | |||
| date: this.operatorMeeting[i].start_date, | |||
| time_start: this.operatorMeeting[i].start_date, | |||
| time_end: this.operatorMeeting[i].end_date, | |||
| type: this.meetingType.name, | |||
| typeType: this.meetingType.type, | |||
| street: this.operatorMeeting[i].street, | |||
| street_no: this.operatorMeeting[i].street_no, | |||
| zip: this.operatorMeeting[i].zip, | |||
| city: this.operatorMeeting[i].city, | |||
| owner: this.owner.firstname + ' ' + this.owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| operatorContactName, | |||
| participants: this.operatorMeeting[i].v_participants, | |||
| department: this.operatorMeeting[i].department, | |||
| email: this.operatorMeeting[i].email, | |||
| phone: this.operatorMeeting[i].phone_no, | |||
| mobile: this.operatorMeeting[i].mobile_no, | |||
| }); | |||
| } | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['date'], b['date'], false)); | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalOperatorMeetingDetail.openModal(); | |||
| this.operatorMeetingDetail.setData(this.operator, this.operatorMeetingEntriesById[e.data.id]); | |||
| } | |||
| /** | |||
| * On create click | |||
| */ | |||
| public create(): void { | |||
| this.modalOperatorMeetingEdit.openModal(); | |||
| this.operatorMeetingEdit.setData(this.operator, Factory.getEmptyOperatorMeeting(this.operator.id), true); | |||
| } | |||
| /** | |||
| * Creates operator meeting | |||
| * @param operatorMeeting | |||
| */ | |||
| public createOperatorMeetingFunction(operatorMeeting: IOperatorMeeting): void { | |||
| this.createMeeting.emit(operatorMeeting); | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param operatorMeeting | |||
| */ | |||
| public editOperatorMeetingFunction(operatorMeeting: IOperatorMeeting) { | |||
| this.editMeeting.emit(operatorMeeting); | |||
| } | |||
| /** | |||
| * Deletes operator meeting | |||
| * @param meetingId | |||
| */ | |||
| public deleteOperatorMeetingFunction(meetingId: number): void { | |||
| this.deleteMeeting.emit(meetingId); | |||
| } | |||
| /** | |||
| * Edit report after meeting has started | |||
| * @param reportValues | |||
| */ | |||
| public editOperatorMeetingReportFunction(reportValues: any): void { | |||
| this.editMeetingReport.emit(reportValues); | |||
| } | |||
| ngOnDestroy(): void { | |||
| } | |||
| } | |||
| @@ -1,45 +0,0 @@ | |||
| <div [hidden]="isEditMode"> | |||
| <h3>Notiz Detail</h3> | |||
| <p>Erstellt am {{creationDate}} von {{operatorNote.creation_user_firstname}} | |||
| {{operatorNote.creation_user_lastname}}</p> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Datum:</dt> | |||
| <dd>{{noteDate}}</dd> | |||
| <dt>Betreff:</dt> | |||
| <dd>{{operatorNote.title}}</dd> | |||
| <dt *ngIf="operatorNote.lastname">Gesprächspartner:</dt> | |||
| <dd *ngIf="operatorNote.lastname"><span *ngIf="operatorNote.gender == 'male'">Herr </span> | |||
| <span *ngIf="operatorNote.gender == 'female'">Frau </span> | |||
| <span *ngIf="operatorNote.gender == 'diverse'">Divers </span>{{operatorNote.firstname}} {{operatorNote.lastname}}</dd> | |||
| <dt *ngIf="operatorNote.department">Abteilung:</dt> | |||
| <dd *ngIf="operatorNote.department">{{operatorNote.department}}</dd> | |||
| <dt *ngIf="operatorNote.email">E-Mail:</dt> | |||
| <dd *ngIf="operatorNote.email"><a href="mailto:{{operatorNote.email}}">{{operatorNote.email}}</a></dd> | |||
| <dt *ngIf="operatorNote.phone_no">Telefon:</dt> | |||
| <dd *ngIf="operatorNote.phone_no"><a href="tel:{{operatorNote.phone_no}}">{{operatorNote.phone_no}}</a></dd> | |||
| <dt *ngIf="operatorNote.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="operatorNote.mobile_no"><a href="tel:{{operatorNote.mobile_no}}">{{operatorNote.mobile_no}}</a></dd> | |||
| <dt *ngIf="operatorNote.fax_no">Fax:</dt> | |||
| <dd *ngIf="operatorNote.fax_no">{{operatorNote.fax_no}}</dd> | |||
| <dt *ngIf="operatorNote.comment">Notiz:</dt> | |||
| <dd class="pre-wrap" *ngIf="operatorNote.comment">{{operatorNote.comment}}</dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| <div class="form"> | |||
| <div class="row row--last" *ngIf="hasEditRights && appService.getAppUser().id == operatorNote.creation_user_id"> | |||
| <div class="column"> | |||
| <div class="button button--inline" (click)="editEntry()">Eintrag bearbeiten</div> | |||
| <div class="button button--inline" (click)="deleteEntry()">Eintrag löschen</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div [hidden]="!isEditMode"> | |||
| <div id="operator-note-edit-modal"> | |||
| <app-operator-note-edit #operatorNoteEdit (editNote)="editOperatorNoteFunction($event)"></app-operator-note-edit> | |||
| </div> | |||
| </div> | |||
| @@ -1,94 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperatorNote} from '../../../../model/entities/operator-note'; | |||
| import {OperatorNoteEditComponent} from '../operator-note-edit/operator-note-edit.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-note-detail', | |||
| templateUrl: './operator-note-detail.component.html', | |||
| styleUrls: ['./operator-note-detail.component.scss'] | |||
| }) | |||
| export class OperatorNoteDetailComponent implements OnInit { | |||
| @Output() editNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() deleteNote: EventEmitter<number> = new EventEmitter<number>(); | |||
| @ViewChild('operatorNoteEdit', { static: true }) operatorNoteEdit: OperatorNoteEditComponent; | |||
| public operator: IOperator; | |||
| public operatorNote: IOperatorNote; | |||
| public creationDate: string; | |||
| public isEditMode: boolean; | |||
| public noteDate: string; | |||
| public hasEditRights: boolean; | |||
| constructor(public appService: AppService) { } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorNote = Factory.getEmptyOperatorNote(); | |||
| this.creationDate = ''; | |||
| this.isEditMode = false; | |||
| this.noteDate = ''; | |||
| } | |||
| /** | |||
| * Set data | |||
| */ | |||
| public setData(operator: IOperator, operatorNote: IOperatorNote): void { | |||
| this.operator = operator; | |||
| this.operatorNote = operatorNote; | |||
| this.creationDate = Utils.getDateTimeToDisplay(this.operatorNote.creation_date); | |||
| this.isEditMode = false; | |||
| this.noteDate = Utils.getDateTimeToDisplay(this.operatorNote.note_date); | |||
| } | |||
| /** | |||
| * Updates data | |||
| * @param operator | |||
| */ | |||
| public updateData(operator: IOperator): void { | |||
| this.operator = operator; | |||
| for (let i = 0; i < this.operator.v_operator_notes.length; i++) { | |||
| if (this.operator.v_operator_notes[i].id == this.operatorNote.id) { | |||
| this.operatorNote = this.operator.v_operator_notes[i]; | |||
| this.noteDate = Utils.getDateTimeToDisplay(this.operatorNote.note_date); | |||
| } | |||
| } | |||
| this.isEditMode = false; | |||
| } | |||
| /** | |||
| * Edit note entry | |||
| */ | |||
| public editEntry(): void { | |||
| this.isEditMode = true; | |||
| this.operatorNoteEdit.setData(this.operator, Utils.deepClone(this.operatorNote) as IOperatorNote); | |||
| } | |||
| /** | |||
| * Edits note entry | |||
| * @param operatorNote | |||
| */ | |||
| public editOperatorNoteFunction(operatorNote: IOperatorNote) { | |||
| this.editNote.emit(operatorNote); | |||
| } | |||
| /** | |||
| * Delete note entry | |||
| */ | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Eintrag wirklich löschen?'); | |||
| if (confirmAction == true) { | |||
| this.deleteNote.emit(this.operatorNote.id); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,116 +0,0 @@ | |||
| <h3 *ngIf="isCreationMode">Notiz anlegen</h3> | |||
| <h3 *ngIf="!isCreationMode">Notiz bearbeiten</h3> | |||
| <form class="form" #operatorNoteForm="ngForm" (ngSubmit)="onFormSubmit(operatorNoteForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="cheDate.invalid && cheDate.touched && cheDate?.errors?.required"> | |||
| Datum ist ein Pflichtfeld. | |||
| </p> | |||
| <p class="error-msg" *ngIf="cheTitle.invalid && cheTitle.touched && cheTitle?.errors?.required"> | |||
| Betreff ist ein Pflichtfeld. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheDate" [class.error]="cheDate.invalid && cheDate.touched && cheDate?.errors?.required"><strong>Datum*</strong></label> | |||
| <input type="date" [class.error]="cheDate.invalid && cheDate.touched && cheDate?.errors?.required" id="cheDate" name="cheDate" required [(ngModel)]="operatorNote.note_date" | |||
| #cheDate="ngModel"/> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheTitle" [class.error]="cheTitle.invalid && cheTitle.touched && cheTitle?.errors?.required"><strong>Betreff*</strong></label> | |||
| <input type="text" [class.error]="cheTitle.invalid && cheTitle.touched && cheTitle?.errors?.required" id="cheTitle" name="cheTitle" required [(ngModel)]="operatorNote.title" | |||
| placeholder="Betreff" #cheTitle="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="cheComment" name="cheComment" [(ngModel)]="operatorNote.comment" #cheComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheContactPerson">Gesprächspartner</label> | |||
| <select id="cheContactPerson" name="cheContactPerson" (change)="selectContact($event)" [(ngModel)]="operatorNote.operator_contact_id" #cheContactPerson="ngModel"> | |||
| <option value="-1">Kein Gesprächspartner</option> | |||
| <option value="0">- Individuell -</option> | |||
| <option *ngFor="let c of operatorContacts" value="{{c.id}}">{{c.firstname}} {{c.lastname}}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"> | |||
| <div *ngIf="operatorNote.operator_contact_id != -1"> | |||
| <label for="cheGender" [class.error]="cheGender.invalid && cheGender.touched && cheGender?.errors?.required"><strong>Anrede*</strong></label> | |||
| <select id="cheGender" [class.error]="cheGender.invalid && cheGender.touched && cheGender?.errors?.required" name="cheGender" required [(ngModel)]="operatorNote.gender" #cheGender="ngModel" [disabled]="isExistingOperatorContact" > | |||
| <option [ngValue]=null>Anrede wählen</option> | |||
| <option value="male">Herr</option> | |||
| <option value="female">Frau</option> | |||
| <option value="diverse">Divers</option> | |||
| </select> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div *ngIf="operatorNote.operator_contact_id != -1"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheFirstname">Vorname</label> | |||
| <input type="text" id="cheFirstname" name="cheFirstname" [(ngModel)]="operatorNote.firstname" #cheFirstname="ngModel" | |||
| placeholder="Brigitte" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cheLastname" [class.error]="cheLastname.invalid && cheLastname.touched && cheLastname?.errors?.required"><strong>Nachname*</strong></label> | |||
| <input type="text" [class.error]="cheLastname.invalid && cheLastname.touched && cheLastname?.errors?.required" id="cheLastname" name="cheLastname" [(ngModel)]="operatorNote.lastname" required | |||
| #cheLastname="ngModel" placeholder="Mustermann" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheDepartment">Abteilung</label> | |||
| <input type="text" id="cheDepartment" name="cheDepartment" [(ngModel)]="operatorNote.department" #cheDepartment="ngModel" | |||
| placeholder="Marketing" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cheEmail" [class.error]="cheEmail.invalid && cheEmail.touched && cheEmail?.errors?.pattern">E-Mail</label> | |||
| <input type="email" [class.error]="cheEmail.invalid && cheEmail.touched && cheEmail?.errors?.pattern" id="cheEmail" name="cheEmail" [(ngModel)]="operatorNote.email" #cheEmail="ngModel" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="chePhoneNo">Telefon</label> | |||
| <input type="text" id="chePhoneNo" name="chePhoneNo" [(ngModel)]="operatorNote.phone_no" #chePhoneNo="ngModel" | |||
| placeholder="040-1234567" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="cheMobileNo">Mobil</label> | |||
| <input type="text" id="cheMobileNo" name="cheMobileNo" [(ngModel)]="operatorNote.mobile_no" #cheMobileNo="ngModel" | |||
| placeholder="0177-1234567" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cheFaxNo">Fax</label> | |||
| <input type="text" id="cheFaxNo" name="cheFaxNo" [(ngModel)]="operatorNote.fax_no" #cheFaxNo="ngModel" | |||
| placeholder="040-1234568" [disabled]="isExistingOperatorContact" /> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button *ngIf="isCreationMode" [disabled]="!operatorNoteForm.valid" class="button" title="Notiz anlegen">Notiz anlegen</button> | |||
| <button *ngIf="!isCreationMode" [disabled]="!operatorNoteForm.valid" class="button" title="Notiz bearbeiten">Notiz bearbeiten</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,127 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| import {IOperatorNote} from '../../../../model/entities/operator-note'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| import {IOperatorContact} from '../../../../model/entities/operator-contact'; | |||
| @Component({ | |||
| selector: 'app-operator-note-edit', | |||
| templateUrl: './operator-note-edit.component.html', | |||
| styleUrls: ['./operator-note-edit.component.scss'] | |||
| }) | |||
| export class OperatorNoteEditComponent extends FormComponent implements OnInit { | |||
| @Output() createNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() editNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @ViewChild('operatorNoteForm', { static: true }) operatorNoteForm: NgForm; | |||
| public operator: IOperator; | |||
| public operatorNote: IOperatorNote; | |||
| public operatorContacts: IOperatorContact[]; | |||
| public operatorContactsById: {}; | |||
| public isExistingOperatorContact: boolean; | |||
| public contactId: string; | |||
| constructor(protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorNote = Factory.getEmptyOperatorNote(); | |||
| this.operatorContacts = []; | |||
| this.operatorContactsById = {}; | |||
| this.errorMsg = ''; | |||
| this.contactId = ''; | |||
| this.isCreationMode = false; | |||
| this.isExistingOperatorContact = false; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param operatorNote | |||
| * @param isCreationMode | |||
| */ | |||
| public setData(operator: IOperator, operatorNote: IOperatorNote, isCreationMode = false): void { | |||
| this.operator = operator; | |||
| this.operatorNote = operatorNote; | |||
| this.operatorContacts = this.operator.v_operator_contacts; | |||
| this.operatorContactsById = Utils.getSortedObjFromArray(this.operatorContacts, 'id'); | |||
| this.operatorNote.operator_id = this.operator.id; | |||
| this.contactId = ''; | |||
| this.isCreationMode = isCreationMode; | |||
| this.errorMsg = ''; | |||
| if (isNull(this.operatorNote.operator_contact_id)) { | |||
| this.operatorNote.operator_contact_id = -1; | |||
| } | |||
| if (this.operatorNote.operator_contact_id > 0) { | |||
| this.isExistingOperatorContact = true; | |||
| } | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * On select contact | |||
| * @param e | |||
| */ | |||
| public selectContact(e: any) { | |||
| this.operatorNote.operator_contact_id = e.target.value; | |||
| this.isExistingOperatorContact = false; | |||
| this.operatorNote.gender = null; | |||
| this.operatorNote.firstname = null; | |||
| this.operatorNote.lastname = null; | |||
| this.operatorNote.department = null; | |||
| this.operatorNote.email = null; | |||
| this.operatorNote.phone_no = null; | |||
| this.operatorNote.mobile_no = null; | |||
| this.operatorNote.fax_no = null; | |||
| if (this.operatorNote.operator_contact_id > 0) { | |||
| this.operatorNote.gender = this.operatorContactsById[this.operatorNote.operator_contact_id].gender; | |||
| this.operatorNote.firstname = this.operatorContactsById[this.operatorNote.operator_contact_id].firstname; | |||
| this.operatorNote.lastname = this.operatorContactsById[this.operatorNote.operator_contact_id].lastname; | |||
| this.operatorNote.department = this.operatorContactsById[this.operatorNote.operator_contact_id].department; | |||
| this.operatorNote.email = this.operatorContactsById[this.operatorNote.operator_contact_id].email; | |||
| this.operatorNote.phone_no = this.operatorContactsById[this.operatorNote.operator_contact_id].phone_no; | |||
| this.operatorNote.mobile_no = this.operatorContactsById[this.operatorNote.operator_contact_id].mobile_no; | |||
| this.operatorNote.fax_no = this.operatorContactsById[this.operatorNote.operator_contact_id].fax_no; | |||
| this.isExistingOperatorContact = true; | |||
| } | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.operatorNoteForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| if (this.operatorNote.operator_contact_id == -1) { | |||
| this.operatorNote.operator_contact_id = null; | |||
| } | |||
| if (this.isCreationMode) { | |||
| this.createNote.emit(this.operatorNote); | |||
| } else { | |||
| this.editNote.emit(this.operatorNote); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'operator-note-modal' : 'operator-note-edit-modal'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,32 +0,0 @@ | |||
| <h3>Notizen</h3> | |||
| <div class="button" id="create-operator-note" (click)="create()" *ngIf="hasEditRights">Notiz hinzufügen</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Notiz suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [enableCellTextSelection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalOperatorNoteDetail> | |||
| <app-operator-note-detail #operatorNoteDetail (editNote)="editOperatorNoteFunction($event)" | |||
| (deleteNote)="deleteOperatorNoteFunction($event)"></app-operator-note-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalOperatorNoteEdit> | |||
| <div id="operator-note-modal"> | |||
| <app-operator-note-edit #operatorNoteEdit (createNote)="createOperatorNoteFunction($event)"></app-operator-note-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,14 +0,0 @@ | |||
| #create-operator-note { | |||
| position: absolute; | |||
| right: 0; | |||
| top: -6rem; | |||
| } | |||
| @media only screen and (max-width: 1004px) { | |||
| #create-operator-note { | |||
| position: relative; | |||
| right: auto; | |||
| top: auto; | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -1,162 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IOperatorNote} from '../../../../model/entities/operator-note'; | |||
| import {OperatorNoteEditComponent} from '../operator-note-edit/operator-note-edit.component'; | |||
| import {OperatorNoteDetailComponent} from '../operator-note-detail/operator-note-detail.component'; | |||
| import {IOperator} from '../../../../model/entities/operator'; | |||
| @Component({ | |||
| selector: 'app-operator-note-view', | |||
| templateUrl: './operator-note-view.component.html', | |||
| styleUrls: ['./operator-note-view.component.scss'] | |||
| }) | |||
| export class OperatorNoteViewComponent extends AgGridComponent implements OnInit { | |||
| @Output() createNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() editNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() deleteNote: EventEmitter<number> = new EventEmitter<number>(); | |||
| @ViewChild('modalOperatorNoteEdit', { static: true }) modalOperatorNoteEdit: ModalComponent; | |||
| @ViewChild('operatorNoteEdit', { static: true }) operatorNoteEdit: OperatorNoteEditComponent; | |||
| @ViewChild('modalOperatorNoteDetail', { static: true }) modalOperatorNoteDetail: ModalComponent; | |||
| @ViewChild('operatorNoteDetail', { static: true }) operatorNoteDetail: OperatorNoteDetailComponent; | |||
| public operator: IOperator; | |||
| public operatorNote: IOperatorNote[]; | |||
| public operatorNoteEntriesById: {}; | |||
| public hasEditRights: boolean; | |||
| constructor(public appService: AppService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.operator = Factory.getEmptyOperator(); | |||
| this.operatorNote = []; | |||
| this.operatorNoteEntriesById = {}; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'Erstellungsdatum', field: 'creation_date', cellRenderer: this.dateRenderer, comparator: this.dateComparator }, | |||
| {headerName: 'Ersteller', field: 'creator' }, | |||
| {headerName: 'Datum', field: 'date', cellRenderer: this.dateRenderer, comparator: this.dateComparator }, | |||
| {headerName: 'Betreff', field: 'title' }, | |||
| {headerName: 'Notiz', field: 'comment' }, | |||
| {headerName: 'Anrede', field: 'gender', width: 90 }, | |||
| {headerName: 'Vorname', field: 'firstname' }, | |||
| {headerName: 'Nachname', field: 'lastname' }, | |||
| {headerName: 'Abteilung', field: 'department' }, | |||
| {headerName: 'E-Mail Adresse', field: 'email', cellRenderer: this.emailRenderer }, | |||
| {headerName: 'Telefon', field: 'phone_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Mobil', field: 'mobile_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Fax', field: 'fax_no' }, | |||
| ]; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param isUpdate | |||
| */ | |||
| public setData(operator: IOperator, isUpdate: boolean): void { | |||
| this.operator = operator; | |||
| this.operatorNote = this.operator.v_operator_notes; | |||
| this.operatorNoteEntriesById = Utils.getSortedObjFromArray(this.operatorNote, 'id'); | |||
| this.modalOperatorNoteEdit.closeModal(); | |||
| this.generateEntries(); | |||
| if (isUpdate) { | |||
| this.operatorNoteDetail.updateData(operator); | |||
| } else { | |||
| this.modalOperatorNoteDetail.closeModal(); | |||
| } | |||
| } | |||
| /** | |||
| * Generates AG grid entries | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| const items: {}[] = []; | |||
| for (let i = 0; i < this.operatorNote.length; i++) { | |||
| let ccGender = ''; | |||
| if (this.operatorNote[i].gender == 'male') { | |||
| ccGender = 'Herr'; | |||
| } else if (this.operatorNote[i].gender == 'female') { | |||
| ccGender = 'Frau'; | |||
| } else if (this.operatorNote[i].gender == 'diverse') { | |||
| ccGender = 'Divers'; | |||
| } | |||
| items.push({ | |||
| id: this.operatorNote[i].id, | |||
| date: this.operatorNote[i].note_date, | |||
| title: this.operatorNote[i].title, | |||
| comment: this.operatorNote[i].comment, | |||
| gender: ccGender, | |||
| firstname: this.operatorNote[i].firstname, | |||
| lastname: this.operatorNote[i].lastname, | |||
| email: this.operatorNote[i].email, | |||
| phone_no: this.operatorNote[i].phone_no, | |||
| mobile_no: this.operatorNote[i].mobile_no, | |||
| fax_no: this.operatorNote[i].fax_no, | |||
| department: this.operatorNote[i].department, | |||
| creation_date: this.operatorNote[i].creation_date, | |||
| creator: this.operatorNote[i].creation_user_firstname + ' ' + this.operatorNote[i].creation_user_lastname, | |||
| }); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['date'], b['date'], false)); | |||
| } | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalOperatorNoteDetail.openModal(); | |||
| this.operatorNoteDetail.setData(this.operator, this.operatorNoteEntriesById[e.data.id]); | |||
| } | |||
| /** | |||
| * On create click | |||
| */ | |||
| public create(): void { | |||
| this.modalOperatorNoteEdit.openModal(); | |||
| this.operatorNoteEdit.setData(this.operator, Factory.getEmptyOperatorNote(this.operator.id, Utils.getCurrentDate()), true); | |||
| } | |||
| /** | |||
| * Creates operator note | |||
| * @param operatorNote | |||
| */ | |||
| public createOperatorNoteFunction(operatorNote: IOperatorNote): void { | |||
| this.createNote.emit(operatorNote); | |||
| } | |||
| /** | |||
| * Edits note entry | |||
| * @param operatorNote | |||
| */ | |||
| public editOperatorNoteFunction(operatorNote: IOperatorNote) { | |||
| this.editNote.emit(operatorNote); | |||
| } | |||
| /** | |||
| * Deletes operator note | |||
| * @param noteId | |||
| */ | |||
| public deleteOperatorNoteFunction(noteId: number): void { | |||
| this.deleteNote.emit(noteId); | |||
| } | |||
| } | |||
| @@ -1,32 +0,0 @@ | |||
| <h2>{{operator.name}}</h2> | |||
| <app-tabs #tabsOperatorView> | |||
| <app-tab tabTitle="Betreiberdaten" [tabIndex]="0"> | |||
| <div class="scollable"> | |||
| <app-operator-data-view #operatorDataView (editOperator)="editOperatorFunction($event)"></app-operator-data-view> | |||
| </div> | |||
| </app-tab> | |||
| <app-tab tabTitle="Ansprechpartner" [tabIndex]="1"> | |||
| <div class="scollable"> | |||
| <app-operator-contact-person-view #operatorContactPersonView | |||
| (createOperatorContact)="createOperatorContactFunction($event)" | |||
| (editOperatorContact)="editOperatorContactFunction($event)" | |||
| (deleteOperatorContact)="deleteOperatorContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-operator-contact-person-view> | |||
| </div> | |||
| </app-tab> | |||
| <app-tab tabTitle="Termine" [tabIndex]="2"> | |||
| <div class="scollable"> | |||
| <app-operator-meeting-view #operatorMeetingView (createMeeting)="createOperatorMeetingFunction($event)" | |||
| (editMeeting)="editOperatorMeetingFunction($event)" | |||
| (deleteMeeting)="deleteOperatorMeetingFunction($event)" | |||
| (editMeetingReport)="editOperatorMeetingReportFunction($event)"></app-operator-meeting-view> | |||
| </div> | |||
| </app-tab> | |||
| <app-tab tabTitle="Notizen" [tabIndex]="3"> | |||
| <div class="scollable"> | |||
| <app-operator-note-view #operatorNoteView (createNote)="createOperatorNoteFunction($event)" | |||
| (editNote)="editOperatorNoteFunction($event)" | |||
| (deleteNote)="deleteOperatorNoteFunction($event)"></app-operator-note-view> | |||
| </div> | |||
| </app-tab> | |||
| </app-tabs> | |||
| @@ -1,156 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {IOperator} from '../../../model/entities/operator'; | |||
| import {TabsComponent} from '../../../components/tabs/tabs.component'; | |||
| import {Factory} from '../../../factory/factory'; | |||
| import {OperatorMeetingViewComponent} from './operator-meeting-view/operator-meeting-view.component'; | |||
| import {OperatorNoteViewComponent} from './operator-note-view/operator-note-view.component'; | |||
| import {OperatorContactPersonViewComponent} from './operator-contact-person-view/operator-contact-person-view.component'; | |||
| import {OperatorDataViewComponent} from './operator-data-view/operator-data-view.component'; | |||
| import {IOperatorMeeting} from '../../../model/entities/operator-meeting'; | |||
| import {IOperatorNote} from '../../../model/entities/operator-note'; | |||
| import {IOperatorContact} from '../../../model/entities/operator-contact'; | |||
| @Component({ | |||
| selector: 'app-operator-view', | |||
| templateUrl: './operator-view.component.html', | |||
| styleUrls: ['./operator-view.component.scss'] | |||
| }) | |||
| export class OperatorViewComponent implements OnInit { | |||
| @Output() editOperator: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @Output() createOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() editOperatorContact: EventEmitter<IOperatorContact> = new EventEmitter<IOperatorContact>(); | |||
| @Output() deleteOperatorContact: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() createNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() editNote: EventEmitter<IOperatorNote> = new EventEmitter<IOperatorNote>(); | |||
| @Output() deleteNote: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() createMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() editMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() deleteMeeting: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() editMeetingReport: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() shortcut: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('tabsOperatorView', { static: true }) tabsOperatorView: TabsComponent; | |||
| @ViewChild('operatorDataView', { static: true }) operatorDataView: OperatorDataViewComponent; | |||
| @ViewChild('operatorContactPersonView', { static: true }) operatorContactPersonView: OperatorContactPersonViewComponent; | |||
| @ViewChild('operatorNoteView', { static: true }) operatorNoteView: OperatorNoteViewComponent; | |||
| @ViewChild('operatorMeetingView', { static: true }) operatorMeetingView: OperatorMeetingViewComponent; | |||
| public operator: IOperator; | |||
| constructor() { } | |||
| ngOnInit() { | |||
| this.operator = Factory.getEmptyOperator(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operator | |||
| * @param isUpdate | |||
| */ | |||
| public setData(operator: IOperator, isUpdate: boolean = false): void { | |||
| this.operator = operator; | |||
| this.operatorDataView.setData(this.operator); | |||
| this.operatorContactPersonView.setData(this.operator, isUpdate); | |||
| this.operatorNoteView.setData(this.operator, isUpdate); | |||
| this.operatorMeetingView.setData(this.operator, isUpdate); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param operator | |||
| */ | |||
| public editOperatorFunction(operator: IOperator): void { | |||
| this.editOperator.emit(operator); | |||
| } | |||
| /** | |||
| * Creates operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public createOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.createOperatorContact.emit(operatorContact); | |||
| } | |||
| /** | |||
| * Edit operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public editOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.editOperatorContact.emit(operatorContact); | |||
| } | |||
| /** | |||
| * Creates operator note | |||
| * @param operatorNote | |||
| */ | |||
| public createOperatorNoteFunction(operatorNote: IOperatorNote): void { | |||
| this.createNote.emit(operatorNote); | |||
| } | |||
| /** | |||
| * Edits note entry | |||
| * @param operatorNote | |||
| */ | |||
| public editOperatorNoteFunction(operatorNote: IOperatorNote) { | |||
| this.editNote.emit(operatorNote); | |||
| } | |||
| /** | |||
| * Deletes operator note | |||
| * @param noteId | |||
| */ | |||
| public deleteOperatorNoteFunction(noteId: number): void { | |||
| this.deleteNote.emit(noteId); | |||
| } | |||
| /** | |||
| * Deletes operator contact | |||
| * @param operatorId | |||
| */ | |||
| public deleteOperatorContactFunction(operatorId: number): void { | |||
| this.deleteOperatorContact.emit(operatorId); | |||
| } | |||
| /** | |||
| * Creates operator meeting | |||
| * @param operatorMeeting | |||
| */ | |||
| public createOperatorMeetingFunction(operatorMeeting: IOperatorMeeting): void { | |||
| this.createMeeting.emit(operatorMeeting); | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param operatorMeeting | |||
| */ | |||
| public editOperatorMeetingFunction(operatorMeeting: IOperatorMeeting) { | |||
| this.editMeeting.emit(operatorMeeting); | |||
| } | |||
| /** | |||
| * Deletes operator meeting | |||
| * @param meetingId | |||
| */ | |||
| public deleteOperatorMeetingFunction(meetingId: number): void { | |||
| this.deleteMeeting.emit(meetingId); | |||
| } | |||
| /** | |||
| * Edit report after meeting has started | |||
| * @param reportValues | |||
| */ | |||
| public editOperatorMeetingReportFunction(reportValues: any): void { | |||
| this.editMeetingReport.emit(reportValues); | |||
| } | |||
| /** | |||
| * Shortcut to operator detail | |||
| * @param operator | |||
| */ | |||
| public shortcutFunction(operator: IOperator): void { | |||
| this.shortcut.emit(operator); | |||
| } | |||
| } | |||
| @@ -1,30 +0,0 @@ | |||
| <div class="button" id="export-operator-contacts" (click)="exportOperatorContactsPdf()" *ngIf="hasExportRights">Ansprechpartner exportieren</div> | |||
| <div class="button" id="xmas-mail" (click)="exportXmasPdf()" *ngIf="hasAdminRights">Weihnachtspost-Etiketten</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [rowSelection]="rowSelection" | |||
| [rowDeselection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalOperatorsContactPersonDetailList> | |||
| <app-operator-contact-person-detail #operatorContactPersonDetailList (editOperatorContact)="editOperatorContactFunction($event)" | |||
| (deleteOperatorContact)="deleteOperatorContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-operator-contact-person-detail> | |||
| </app-modal> | |||
| @@ -1,11 +0,0 @@ | |||
| #xmas-mail { | |||
| position: absolute; | |||
| right: 0; | |||
| top: 0; | |||
| } | |||
| #export-operator-contacts { | |||
| position: absolute; | |||
| right: 225px; | |||
| top: 0; | |||
| } | |||
| @@ -1,161 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../components/modal/modal.component'; | |||
| import {OperatorContactPersonDetailComponent} from '../operator-view/operator-contact-person-detail/operator-contact-person-detail.component'; | |||
| import {IOperator} from '../../../model/entities/operator'; | |||
| import {OperatorService} from '../../../services/operator.service'; | |||
| import {IOperatorContact} from '../../../model/entities/operator-contact'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| import {Const} from '../../../utils/const'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {CommonService} from '../../../services/common.service'; | |||
| @Component({ | |||
| selector: 'app-operators-contact-list', | |||
| templateUrl: './operators-contact-list.component.html', | |||
| styleUrls: ['./operators-contact-list.component.scss'] | |||
| }) | |||
| export class OperatorsContactListComponent extends AgGridComponent implements OnInit { | |||
| @Output() shortcut: EventEmitter<IOperator> = new EventEmitter<IOperator>(); | |||
| @ViewChild('modalOperatorsContactPersonDetailList', { static: true }) modalOperatorsContactPersonDetailList: ModalComponent; | |||
| @ViewChild('operatorContactPersonDetailList', { static: true }) operatorContactPersonDetailList: OperatorContactPersonDetailComponent; | |||
| public operators: IOperator[]; | |||
| public operatorsById: {}; | |||
| private operatorContacts: IOperatorContact[]; | |||
| public operatorContactsById: {}; | |||
| public hasAdminRights: boolean; | |||
| public hasExportRights: boolean; | |||
| constructor(public appService: AppService, private operatorService: OperatorService, private commonService: CommonService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasAdminRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||
| this.hasExportRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_ADMIN) || | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE); | |||
| this.operators = []; | |||
| this.operatorsById = {}; | |||
| this.operatorContacts = []; | |||
| this.operatorContactsById = {}; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'ID', field: 'id', width: 60 }, | |||
| {headerName: 'Betreiber ID', field: 'operator_id', width: 100 }, | |||
| {headerName: 'Betreiber', field: 'operator' }, | |||
| {headerName: 'Vorname', field: 'firstname' }, | |||
| {headerName: 'Nachname', field: 'lastname' }, | |||
| {headerName: 'Abteilung', field: 'department' }, | |||
| {headerName: 'E-Mail Adresse', field: 'email', cellRenderer: this.emailRenderer }, | |||
| {headerName: 'Telefon', field: 'phone_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Mobil', field: 'mobile_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Fax', field: 'fax_no' }, | |||
| {headerName: 'Bemerkungen', field: 'comment' } | |||
| ]; | |||
| this.rowSelection = 'single'; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operators | |||
| * @param operatorContacts | |||
| */ | |||
| public setData(operators: IOperator[], operatorContacts: IOperatorContact[]): void { | |||
| this.operators = operators; | |||
| this.operatorsById = Utils.getSortedObjFromArray(this.operators, 'id'); | |||
| this.operatorContacts = operatorContacts; | |||
| this.operatorContactsById = Utils.getSortedObjFromArray(this.operatorContacts, 'id'); | |||
| this.generateEntries(); | |||
| } | |||
| /** | |||
| * Generates AG grid entries for operators grid | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| for (let i = 0; i < this.operatorContacts.length; i++) { | |||
| this.rowData.push({ | |||
| id: this.operatorContacts[i].id, | |||
| operator_id: this.operatorContacts[i].operator_id, | |||
| operator: this.operatorsById[this.operatorContacts[i].operator_id].name, | |||
| firstname: this.operatorContacts[i].firstname, | |||
| lastname: this.operatorContacts[i].lastname, | |||
| department: this.operatorContacts[i].department, | |||
| email: this.operatorContacts[i].email, | |||
| phone_no: this.operatorContacts[i].phone_no, | |||
| mobile_no: this.operatorContacts[i].mobile_no, | |||
| fax_no: this.operatorContacts[i].fax_no, | |||
| comment: this.operatorContacts[i].comment | |||
| }); | |||
| } | |||
| } | |||
| /** | |||
| * Row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalOperatorsContactPersonDetailList.openModal(); | |||
| this.operatorContactPersonDetailList.setData(this.operatorsById[e.data.operator_id], Utils.deepClone(this.operatorContactsById[e.data.id]) as IOperatorContact); | |||
| } | |||
| /** | |||
| * Edit operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public editOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.operatorService.apiEditOperatorContact(operatorContact).subscribe( | |||
| data => { | |||
| this.operatorContactPersonDetailList.updateData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Delete operator contact | |||
| * @param operatorId | |||
| */ | |||
| public deleteOperatorContactFunction(operatorId: number): void { | |||
| this.operatorService.apiDeleteOperatorContact(operatorId).subscribe( | |||
| data => { | |||
| this.modalOperatorsContactPersonDetailList.closeModal(); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Shortcut to operator detail | |||
| * @param operator | |||
| */ | |||
| public shortcutFunction(operator: IOperator): void { | |||
| this.modalOperatorsContactPersonDetailList.closeModal(); | |||
| this.shortcut.emit(operator); | |||
| } | |||
| /** | |||
| * Export operator contacts pdf | |||
| */ | |||
| public exportOperatorContactsPdf(): void { | |||
| this.commonService.apiExportContactsPdf('Betreiber_Kontakte', 'operator'); | |||
| } | |||
| /** | |||
| * Export operator xmas pdf | |||
| */ | |||
| public exportXmasPdf(): void { | |||
| this.commonService.apiExportXmasPdf('Betreiber_Weihnachten', 'operator'); | |||
| } | |||
| } | |||
| @@ -1,24 +0,0 @@ | |||
| <div class="button" id="create-operator" (click)="createOperator()" *ngIf="hasEditRights">Betreiber anlegen</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Betreiber suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [rowSelection]="rowSelection" | |||
| [rowDeselection]="true" | |||
| [rowClassRules]="rowClassRules" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| @@ -1,14 +0,0 @@ | |||
| #create-operator { | |||
| position: absolute; | |||
| right: 0; | |||
| top: 0; | |||
| } | |||
| @media only screen and (max-width: 1004px) { | |||
| #create-operator { | |||
| position: relative; | |||
| right: auto; | |||
| top: auto; | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -1,112 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../components/ag-grid-component'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {Const} from '../../../utils/const'; | |||
| import {IOperator} from '../../../model/entities/operator'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-operators-list', | |||
| templateUrl: './operators-list.component.html', | |||
| styleUrls: ['./operators-list.component.scss'] | |||
| }) | |||
| export class OperatorsListComponent extends AgGridComponent implements OnInit { | |||
| @Output() rowIsClicked: EventEmitter<any> = new EventEmitter<any>(); | |||
| @Output() createNewOperator: EventEmitter<boolean> = new EventEmitter<boolean>(); | |||
| private operators: IOperator[]; | |||
| public rowClassRules: {}; | |||
| public hasEditRights: boolean; | |||
| constructor(public appService: AppService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_ACCOUNTING); | |||
| this.operators = []; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'ID', field: 'operator_id', width: 60 }, | |||
| {headerName: 'Status', field: 'active', width: 90 }, | |||
| {headerName: 'Name', field: 'operator_name' }, | |||
| {headerName: 'Name Zusatz', field: 'operator_name_additional' }, | |||
| {headerName: 'Alte PLP Kennung', field: 'old_plp_id' }, | |||
| {headerName: 'Straße', field: 'street' }, | |||
| {headerName: 'Hausnummer', field: 'street_no' }, | |||
| {headerName: 'PLZ', field: 'zip' }, | |||
| {headerName: 'Ort', field: 'city' }, | |||
| {headerName: 'Internetadresse', field: 'url', cellRenderer: this.urlRenderer }, | |||
| {headerName: 'Bemerkungen (Allgemein)', field: 'comment' } | |||
| ]; | |||
| this.rowSelection = 'single'; | |||
| this.rowClassRules = { | |||
| inactive(params) { | |||
| return !params.data.active_state; | |||
| } | |||
| }; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param operators | |||
| */ | |||
| public setData(operators: IOperator[]): void { | |||
| this.operators = operators; | |||
| this.generateEntries(); | |||
| } | |||
| /** | |||
| * Generates AG grid entries for operators grid | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| if (!isNull(this.operators)) { | |||
| for (let i = 0; i < this.operators.length; i++) { | |||
| this.rowData.push({ | |||
| operator_id: this.operators[i].id, | |||
| active_state: this.operators[i].active, | |||
| active: this.operators[i].active ? 'Aktiv' : 'Inaktiv', | |||
| operator_name: this.operators[i].name, | |||
| operator_name_additional: this.operators[i].name_additional, | |||
| old_plp_id: this.operators[i].old_plp_id, | |||
| street: this.operators[i].street, | |||
| street_no: this.operators[i].street_no, | |||
| zip: this.operators[i].zip, | |||
| city: this.operators[i].city, | |||
| url: this.operators[i].url, | |||
| comment: this.operators[i].comment, | |||
| }); | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.rowIsClicked.emit(e); | |||
| } | |||
| /** | |||
| * OnClick Create Operator | |||
| */ | |||
| public createOperator(): void { | |||
| this.createNewOperator.emit(true); | |||
| } | |||
| } | |||
| @@ -1,34 +0,0 @@ | |||
| <div class="content" #content> | |||
| <h1 #headline>Betreiber</h1> | |||
| <app-tabs #tabsCM> | |||
| <app-tab tabTitle="Betreiber" [tabIndex]="0"> | |||
| <app-operators-list #operatorsList (rowIsClicked)="rowClickedOperator($event)" | |||
| (createNewOperator)="createOperator()"></app-operators-list> | |||
| </app-tab> | |||
| <app-tab tabTitle="Ansprechpartner (Betreiber)" [tabIndex]="1"> | |||
| <app-operators-contact-list #operatorsContactList (shortcut)="shortcutFunction($event)"></app-operators-contact-list> | |||
| </app-tab> | |||
| </app-tabs> | |||
| </div> | |||
| <app-modal #modalOperator> | |||
| <app-operator-view #operatorView | |||
| (editOperator)="editOperatorFunction($event)" | |||
| (createOperatorContact)="createOperatorContactFunction($event)" | |||
| (editOperatorContact)="editOperatorContactFunction($event)" | |||
| (deleteOperatorContact)="deleteOperatorContactFunction($event)" | |||
| (createNote)="createOperatorNoteFunction($event)" | |||
| (editNote)="editOperatorNoteFunction($event)" | |||
| (deleteNote)="deleteOperatorNoteFunction($event)" | |||
| (createMeeting)="createOperatorMeetingFunction($event)" | |||
| (editMeeting)="editOperatorMeetingFunction($event)" | |||
| (deleteMeeting)="deleteOperatorMeetingFunction($event)" | |||
| (editMeetingReport)="editOperatorMeetingReportFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-operator-view> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalOperatorDataEdit> | |||
| <div id="operator-data-modal"> | |||
| <app-operator-data-edit #operatorDataEdit (createOperator)="createOperatorFunction($event)"></app-operator-data-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,279 +0,0 @@ | |||
| import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../components/ag-grid-component'; | |||
| import {AppService} from '../../services/app.service'; | |||
| import {MeetingService} from '../../services/meeting.service'; | |||
| import {TabsComponent} from '../../components/tabs/tabs.component'; | |||
| import {ModalComponent} from '../../components/modal/modal.component'; | |||
| import {Subscription} from 'rxjs'; | |||
| import {OperatorViewComponent} from './operator-view/operator-view.component'; | |||
| import {OperatorsListComponent} from './operators-list/operators-list.component'; | |||
| import {OperatorsContactListComponent} from './operators-contact-list/operators-contact-list.component'; | |||
| import {IOperator} from '../../model/entities/operator'; | |||
| import {IOperatorContact} from '../../model/entities/operator-contact'; | |||
| import {Factory} from '../../factory/factory'; | |||
| import {OperatorDataEditComponent} from './operator-view/operator-data-edit/operator-data-edit.component'; | |||
| import {OperatorService} from '../../services/operator.service'; | |||
| import {IOperatorNote} from '../../model/entities/operator-note'; | |||
| import {IOperatorMeeting} from '../../model/entities/operator-meeting'; | |||
| import {isNull} from 'util'; | |||
| @Component({ | |||
| selector: 'app-operators', | |||
| templateUrl: './operators.component.html', | |||
| styleUrls: ['./operators.component.scss'] | |||
| }) | |||
| export class OperatorsComponent extends AgGridComponent implements OnInit, OnDestroy { | |||
| @ViewChild('tabsCM', { static: true }) tabsCM: TabsComponent; | |||
| @ViewChild('modalOperator', { static: true }) modalOperator: ModalComponent; | |||
| @ViewChild('operatorView', { static: true }) operatorView: OperatorViewComponent; | |||
| @ViewChild('operatorsList', { static: true }) operatorsList: OperatorsListComponent; | |||
| @ViewChild('operatorsContactList', { static: true }) operatorsContactList: OperatorsContactListComponent; | |||
| @ViewChild('modalOperatorDataEdit', { static: true }) modalOperatorDataEdit: ModalComponent; | |||
| @ViewChild('operatorDataEdit', { static: true }) operatorDataEdit: OperatorDataEditComponent; | |||
| @ViewChild('headline', { static: true }) headline: ElementRef; | |||
| @ViewChild('content', { static: true }) content: ElementRef; | |||
| private operators: IOperator[]; | |||
| private operatorsSub: Subscription; | |||
| private operatorsContactsSub: Subscription; | |||
| public operatorContacts: IOperatorContact[]; | |||
| constructor(private appService: AppService, private operatorService: OperatorService, private meetingService: MeetingService) { | |||
| super(); | |||
| this.operatorService.apiGetOperatorData(); | |||
| } | |||
| ngOnInit() { | |||
| this.operatorContacts = []; | |||
| this.operatorsSub = this.operatorService.getOperators$().subscribe( | |||
| data => { | |||
| this.operators = data; | |||
| this.setComponentData(); | |||
| } | |||
| ); | |||
| this.operatorsContactsSub = this.operatorService.getOperatorContacts$().subscribe( | |||
| data => { | |||
| this.operatorContacts = data; | |||
| this.setComponentData(); | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Set component data after all data has been received | |||
| */ | |||
| private setComponentData() { | |||
| if (!isNull(this.operators) && !isNull(this.operatorContacts)) { | |||
| this.operatorsList.setData(this.operators); | |||
| this.operatorsContactList.setData(this.operators, this.operatorContacts); | |||
| } | |||
| } | |||
| /** | |||
| * Operator row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClickedOperator(e: any) { | |||
| this.operatorService.apiGetOperatorFull(e.data.operator_id).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| this.modalOperator.openModal(); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * OnClick Create operator | |||
| */ | |||
| public createOperator(): void { | |||
| this.modalOperatorDataEdit.openModal(); | |||
| this.operatorDataEdit.setData(Factory.getEmptyOperator()); | |||
| } | |||
| /** | |||
| * Creates operator | |||
| * @param operator | |||
| */ | |||
| public createOperatorFunction(operator: IOperator): void { | |||
| this.operatorService.apiCreateOperator(operator).subscribe( | |||
| data => { | |||
| this.modalOperatorDataEdit.closeModal(); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Saves operator | |||
| * @param operator | |||
| */ | |||
| public editOperatorFunction(operator: IOperator): void { | |||
| this.operatorService.apiEditOperator(operator).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Creates operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public createOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.operatorService.apiCreateOperatorContact(operatorContact).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Edit operator contact | |||
| * @param operatorContact | |||
| */ | |||
| public editOperatorContactFunction(operatorContact: IOperatorContact): void { | |||
| this.operatorService.apiEditOperatorContact(operatorContact).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Deletes operator contact | |||
| * @param operatorId | |||
| */ | |||
| public deleteOperatorContactFunction(operatorId: number): void { | |||
| this.operatorService.apiDeleteOperatorContact(operatorId).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Creates operator note entry | |||
| * @param operatorNote | |||
| */ | |||
| public createOperatorNoteFunction(operatorNote: IOperatorNote): void { | |||
| this.operatorService.apiCreateOperatorNote(operatorNote).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Edits operator note entry | |||
| * @param operatorNote | |||
| */ | |||
| public editOperatorNoteFunction(operatorNote: IOperatorNote): void { | |||
| this.operatorService.apiEditOperatorNote(operatorNote).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Deletes operator note entry | |||
| * @param operatorNoteId | |||
| */ | |||
| public deleteOperatorNoteFunction(operatorNoteId: number): void { | |||
| this.operatorService.apiDeleteOperatorNote(operatorNoteId).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Creates operator meeting entry | |||
| * @param operatorMeeting | |||
| */ | |||
| public createOperatorMeetingFunction(operatorMeeting: IOperatorMeeting): void { | |||
| this.meetingService.apiCreateOperatorMeeting(operatorMeeting).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Edits operator meeting entry | |||
| * @param operatorMeeting | |||
| */ | |||
| public editOperatorMeetingFunction(operatorMeeting: IOperatorMeeting): void { | |||
| this.meetingService.apiEditOperatorMeeting(operatorMeeting).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Deletes operator meeting entry | |||
| * @param operatorMeetingId | |||
| */ | |||
| public deleteOperatorMeetingFunction(operatorMeetingId: number): void { | |||
| this.meetingService.apiDeleteOperatorMeeting(operatorMeetingId).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Edit report after meeting has started | |||
| * @param reportValues | |||
| */ | |||
| public editOperatorMeetingReportFunction(reportValues: any): void { | |||
| const meetingId: number = reportValues.id; | |||
| const report: string = reportValues.report; | |||
| this.meetingService.apiEditOperatorMeetingReport(meetingId, report).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Shortcut to operator detail | |||
| * @param operator | |||
| */ | |||
| public shortcutFunction(operator: IOperator): void { | |||
| this.operatorService.apiGetOperatorFull(operator.id).subscribe( | |||
| data => { | |||
| this.operatorView.setData(data.result_data as IOperator); | |||
| this.modalOperator.openModal(); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| /** | |||
| * Destroy | |||
| */ | |||
| ngOnDestroy(): void { | |||
| if (this.operatorsSub !== null && this.operatorsSub !== undefined) { | |||
| this.operatorsSub.unsubscribe(); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,48 +0,0 @@ | |||
| <div [hidden]="isEditMode"> | |||
| <h3>Ansprechpartner Detail</h3> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Gesprächspartner:</dt> | |||
| <dd><span *ngIf="productionContact.gender == 'male'">Herr </span> | |||
| <span *ngIf="productionContact.gender == 'female'">Frau </span> | |||
| <span *ngIf="productionContact.gender == 'diverse'">Divers </span>{{productionContact.firstname}} {{productionContact.lastname}}</dd> | |||
| <dt *ngIf="productionContact.department">Abteilung:</dt> | |||
| <dd *ngIf="productionContact.department">{{productionContact.department}}</dd> | |||
| <dt *ngIf="productionContact.email">E-Mail:</dt> | |||
| <dd *ngIf="productionContact.email"><a href="mailto:{{productionContact.email}}">{{productionContact.email}}</a></dd> | |||
| <dt *ngIf="productionContact.phone_no">Telefon:</dt> | |||
| <dd *ngIf="productionContact.phone_no"><a href="tel:{{productionContact.phone_no}}">{{productionContact.phone_no}}</a></dd> | |||
| <dt *ngIf="productionContact.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="productionContact.mobile_no"><a href="tel:{{productionContact.mobile_no}}">{{productionContact.mobile_no}}</a></dd> | |||
| <dt *ngIf="productionContact.fax_no">Fax:</dt> | |||
| <dd *ngIf="productionContact.fax_no">{{productionContact.fax_no}}</dd> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{productionContact.street}} {{productionContact.street_no}}<br /> | |||
| {{productionContact.zip}} {{productionContact.city}} | |||
| <ng-container *ngIf="productionContact.country_id != null"><br />{{config.vc_countries_by_id[productionContact.country_id]['name']}}</ng-container></dd> | |||
| <dt *ngIf="productionContact.comment">Notiz:</dt> | |||
| <dd class="pre-wrap" *ngIf="productionContact.comment">{{productionContact.comment}}</dd> | |||
| <dt>Markiert für Weihnachtspost:</dt> | |||
| <dd> | |||
| <span *ngIf="productionContact.is_xmas_mail_recipient">Ja</span> | |||
| <span *ngIf="!productionContact.is_xmas_mail_recipient">Nein</span> | |||
| </dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| <div class="form" *ngIf="hasEditRights"> | |||
| <div class="row row--last"> | |||
| <div class="column button-row"> | |||
| <span class="button-row--link" (click)="productionShortcut()">Zum Produzentenprofil</span> | |||
| <div class="button button--inline" (click)="editEntry()">Eintrag bearbeiten</div> | |||
| <div class="button button--inline" (click)="deleteEntry()">Eintrag löschen</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div [hidden]="!isEditMode"> | |||
| <div id="production-contact-person-edit-modal"> | |||
| <app-production-contact-person-edit #productionContactEdit (editProductionContact)="editProductionContactFunction($event)"></app-production-contact-person-edit> | |||
| </div> | |||
| </div> | |||
| @@ -1,108 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IProductionContact} from '../../../../model/entities/production-contact'; | |||
| import {IProduction} from '../../../../model/entities/production'; | |||
| import { | |||
| ProductionContactPersonEditComponent | |||
| } from '../production-contact-person-edit/production-contact-person-edit.component'; | |||
| @Component({ | |||
| selector: 'app-production-contact-person-detail', | |||
| templateUrl: './production-contact-person-detail.component.html', | |||
| styleUrls: ['./production-contact-person-detail.component.scss'] | |||
| }) | |||
| export class ProductionContactPersonDetailComponent implements OnInit { | |||
| @Output() deleteProductionContact: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() editProductionContact: EventEmitter<IProductionContact> = new EventEmitter<IProductionContact>(); | |||
| @Output() shortcut: EventEmitter<IProduction> = new EventEmitter<IProduction>(); | |||
| @ViewChild('productionContactEdit', { static: true }) productionContactEdit: ProductionContactPersonEditComponent; | |||
| public isEditMode: boolean; | |||
| public production: IProduction; | |||
| public productionContact: IProductionContact; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(public appService: AppService) { } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_PRODUCTION) || | |||
| this.appService.userHasRole(Const.USER_ROLE_SERVICE); | |||
| this.config = this.appService.getConfig(); | |||
| this.isEditMode = false; | |||
| this.production = Factory.getEmptyProduction(); | |||
| this.productionContact = Factory.getEmptyProductionContact(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| */ | |||
| public setData(production: IProduction, productionContact: IProductionContact): void { | |||
| this.setContactPersonData(production); | |||
| this.productionContact = productionContact; | |||
| } | |||
| /** | |||
| * Updates data | |||
| * @param production | |||
| */ | |||
| public updateData(production: IProduction): void { | |||
| this.setContactPersonData(production); | |||
| for (let i = 0; i < this.production.v_production_contacts.length; i++) { | |||
| if (this.production.v_production_contacts[i].id === this.productionContact.id) { | |||
| this.productionContact = this.production.v_production_contacts[i]; | |||
| } | |||
| } | |||
| } | |||
| /** | |||
| * Sets contact person data | |||
| * @param production | |||
| */ | |||
| public setContactPersonData(production: IProduction): void { | |||
| this.isEditMode = false; | |||
| this.production = production; | |||
| } | |||
| /** | |||
| * Edit contact entry | |||
| */ | |||
| public editEntry(): void { | |||
| this.isEditMode = true; | |||
| this.productionContactEdit.setData(Utils.deepClone(this.productionContact) as IProductionContact); | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param productionContact | |||
| */ | |||
| public editProductionContactFunction(productionContact: IProductionContact) { | |||
| this.editProductionContact.emit(productionContact); | |||
| } | |||
| /** | |||
| * Delete contact entry | |||
| */ | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Ansprechpartner wirklich löschen?'); | |||
| if (confirmAction == true) { | |||
| this.deleteProductionContact.emit(this.productionContact.id); | |||
| } | |||
| } | |||
| /** | |||
| * Shortcut to production detail | |||
| */ | |||
| public productionShortcut(): void { | |||
| this.shortcut.emit(this.production); | |||
| } | |||
| } | |||
| @@ -1,135 +0,0 @@ | |||
| <h3 *ngIf="isCreationMode">Ansprechpartner anlegen</h3> | |||
| <h3 *ngIf="!isCreationMode">Ansprechpartner bearbeiten</h3> | |||
| <form class="form" #productionContactForm="ngForm" (ngSubmit)="onFormSubmit(productionContactForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required"> | |||
| Anrede ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required" class="error-msg"> | |||
| Nachname ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern" class="error-msg"> | |||
| Bitte gültige E-Mail Adresse eingeben. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeGender" [class.error]="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required"><strong>Anrede*</strong></label> | |||
| <select id="ccpeGender" [class.error]="ccpeGender.invalid && ccpeGender.touched && ccpeGender?.errors?.required" | |||
| name="ccpeGender" required [(ngModel)]="productionContact.gender" #ccpeGender="ngModel"> | |||
| <option [ngValue]=null>Anrede wählen</option> | |||
| <option value="male">Herr</option> | |||
| <option value="female">Frau</option> | |||
| <option value="diverse">Divers</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeFirstname">Vorname</label> | |||
| <input type="text" id="ccpeFirstname" name="ccpeFirstname" [(ngModel)]="productionContact.firstname" #ccpeFirstname="ngModel" | |||
| placeholder="Brigitte"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeLastname" [class.error]="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required"><strong>Nachname*</strong></label> | |||
| <input type="text" [class.error]="ccpeLastname.invalid && ccpeLastname.touched && ccpeLastname?.errors?.required" id="ccpeLastname" name="ccpeLastname" [(ngModel)]="productionContact.lastname" required | |||
| #ccpeLastname="ngModel" placeholder="Mustermann"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeDepartment">Abteilung</label> | |||
| <input type="text" id="ccpeDepartment" name="ccpeDepartment" [(ngModel)]="productionContact.department" #ccpeDepartment="ngModel" | |||
| placeholder="Marketing"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeEmail" [class.error]="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern">E-Mail</label> | |||
| <input type="email" [class.error]="ccpeEmail.invalid && ccpeEmail.touched && ccpeEmail?.errors?.pattern" id="ccpeEmail" name="ccpeEmail" [(ngModel)]="productionContact.email" #ccpeEmail="ngModel" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpePhoneNo">Telefon</label> | |||
| <input type="text" id="ccpePhoneNo" name="ccpePhoneNo" [(ngModel)]="productionContact.phone_no" | |||
| placeholder="040-1234567" #ccpePhoneNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeMobileNo">Mobil</label> | |||
| <input type="text" id="ccpeMobileNo" name="ccpeMobileNo" [(ngModel)]="productionContact.mobile_no" | |||
| placeholder="0177-1234567" #ccpeMobileNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeFaxNo">Fax</label> | |||
| <input type="text" id="ccpeFaxNo" name="ccpeFaxNo" [(ngModel)]="productionContact.fax_no" | |||
| placeholder="040-1234568" #ccpeFaxNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeDateOfBirth">Geburtsdatum</label> | |||
| <input type="date" id="ccpeDateOfBirth" name="ccpeDateOfBirth" [(ngModel)]="productionContact.date_of_birth" | |||
| placeholder="01.01.1979" #ccpeDateOfBirth="ngModel"/> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="ccpeComment" name="ccpeComment" [(ngModel)]="productionContact.comment" #ccpeComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeStreet">Straße</label> | |||
| <input type="text" id="ccpeStreet" name="ccpeStreet" [(ngModel)]="productionContact.street" | |||
| placeholder="Musterstraße" #ccpeStreet="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeStreetNo">Hausnummer</label> | |||
| <input type="text" id="ccpeStreetNo" name="ccpeStreetNo" [(ngModel)]="productionContact.street_no" | |||
| placeholder="1a" #ccpeStreetNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="ccpeZip">PLZ</label> | |||
| <input type="text" id="ccpeZip" name="ccpeZip" [(ngModel)]="productionContact.zip" | |||
| placeholder="12345" #ccpeZip="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeCity">Ort</label> | |||
| <input type="text" id="ccpeCity" name="ccpeCity" [(ngModel)]="productionContact.city" | |||
| placeholder="Musterstadt" #ccpeCity="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cdeCountry">Land</label> | |||
| <select id="cdeCountry" name="cdeCountry" [(ngModel)]="productionContact.country_id" #cdeCountry="ngModel"> | |||
| <option [ngValue]=null>Land wählen</option> | |||
| <option *ngFor="let c of config.countries" value="{{ c.id }}">{{ c.name }}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="ccpeXmas">Markiert für Weihnachtspost</label> | |||
| <input type="checkbox" id="ccpeXmas" name="ccpeXmas" [(ngModel)]="productionContact.is_xmas_mail_recipient" #ccpeXmas="ngModel"/> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!productionContactForm.valid" title="Ansprechpartner speichern" *ngIf="!isCreationMode">Ansprechpartner speichern</button> | |||
| <button class="button" [disabled]="!productionContactForm.valid" title="Ansprechpartner anlegen" *ngIf="isCreationMode">Ansprechpartner anlegen</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,80 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {isNull} from 'util'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IProductionContact} from '../../../../model/entities/production-contact'; | |||
| @Component({ | |||
| selector: 'app-production-contact-person-edit', | |||
| templateUrl: './production-contact-person-edit.component.html', | |||
| styleUrls: ['./production-contact-person-edit.component.scss'] | |||
| }) | |||
| export class ProductionContactPersonEditComponent extends FormComponent implements OnInit { | |||
| @Output() createProductionContact: EventEmitter<IProductionContact> = new EventEmitter<IProductionContact>(); | |||
| @Output() editProductionContact: EventEmitter<IProductionContact> = new EventEmitter<IProductionContact>(); | |||
| @ViewChild('productionContactForm', { static: true }) productionContactForm: NgForm; | |||
| public productionContact: IProductionContact; | |||
| public config: IConfig; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.productionContact = Factory.getEmptyProductionContact(); | |||
| this.config = this.appService.getConfig(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param productionContact | |||
| */ | |||
| public setData(productionContact: IProductionContact): void { | |||
| this.productionContact = productionContact; | |||
| this.isCreationMode = isNull(this.productionContact.id); | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.productionContactForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves production | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| // Check if date is valid | |||
| if (isNull(this.productionContact.date_of_birth) || | |||
| (!isNull(this.productionContact.date_of_birth) && Utils.isValidDate(this.productionContact.date_of_birth))) { | |||
| if (this.isCreationMode) { | |||
| this.createProductionContact.emit(this.productionContact); | |||
| } else { | |||
| this.editProductionContact.emit(this.productionContact); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(this.isCreationMode ? 'production-contact-person-modal' : 'production-contact-person-edit-modal'); | |||
| } | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'production-contact-person-modal' : 'production-contact-person-edit-modal'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,35 +0,0 @@ | |||
| <h3>Ansprechpartner</h3> | |||
| <p>Hier sind die Ansprechpartner zu sehen:</p> | |||
| <div class="button" id="create-production-contact" (click)="create()" *ngIf="hasEditRights">Ansprechpartner anlegen</div> | |||
| <form class="searchForm"> | |||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | |||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | |||
| </form> | |||
| <div class="ag-grid-box"> | |||
| <ag-grid-angular | |||
| style="width: 100%;height: 100%;" | |||
| class="ag-theme-balham" | |||
| [defaultColDef]="defaultColDef" | |||
| [rowData]="rowData" | |||
| [columnDefs]="columnDefs" | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [enableCellTextSelection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalProductionContactPersonDetail> | |||
| <app-production-contact-person-detail #productionContactPersonDetail (editProductionContact)="editProductionContactFunction($event)" | |||
| (deleteProductionContact)="deleteProductionContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-production-contact-person-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalProductionContactPersonEdit> | |||
| <div id="production-contact-person-modal"> | |||
| <app-production-contact-person-edit #productionContactPersonEdit | |||
| (createProductionContact)="createProductionContactFunction($event)"></app-production-contact-person-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,14 +0,0 @@ | |||
| #create-production-contact { | |||
| position: absolute; | |||
| right: 0; | |||
| top: -6rem; | |||
| } | |||
| @media only screen and (max-width: 1004px) { | |||
| #create-production-contact { | |||
| position: relative; | |||
| right: auto; | |||
| top: auto; | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -1,181 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../../components/ag-grid-component'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {isNull} from 'util'; | |||
| import {IProductionContact} from '../../../../model/entities/production-contact'; | |||
| import {IProduction} from '../../../../model/entities/production'; | |||
| import { | |||
| ProductionContactPersonEditComponent | |||
| } from '../production-contact-person-edit/production-contact-person-edit.component'; | |||
| import { | |||
| ProductionContactPersonDetailComponent | |||
| } from '../production-contact-person-detail/production-contact-person-detail.component'; | |||
| @Component({ | |||
| selector: 'app-production-contact-person-view', | |||
| templateUrl: './production-contact-person-view.component.html', | |||
| styleUrls: ['./production-contact-person-view.component.scss'] | |||
| }) | |||
| export class ProductionContactPersonViewComponent extends AgGridComponent implements OnInit { | |||
| @Output() createProductionContact: EventEmitter<IProductionContact> = new EventEmitter<IProductionContact>(); | |||
| @Output() editProductionContact: EventEmitter<IProductionContact> = new EventEmitter<IProductionContact>(); | |||
| @Output() deleteProductionContact: EventEmitter<number> = new EventEmitter<number>(); | |||
| @Output() shortcut: EventEmitter<IProduction> = new EventEmitter<IProduction>(); | |||
| @ViewChild('modalProductionContactPersonEdit', { static: true }) modalProductionContactPersonEdit: ModalComponent; | |||
| @ViewChild('productionContactPersonEdit', { static: true }) productionContactPersonEdit: ProductionContactPersonEditComponent; | |||
| @ViewChild('modalProductionContactPersonDetail', { static: true }) modalProductionContactPersonDetail: ModalComponent; | |||
| @ViewChild('productionContactPersonDetail', { static: true }) productionContactPersonDetail: ProductionContactPersonDetailComponent; | |||
| public production: IProduction; | |||
| public productionContacts: IProductionContact[]; | |||
| public productionContactsById: {}; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(private appService: AppService) { | |||
| super(); | |||
| } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_PRODUCTION) || | |||
| this.appService.userHasRole(Const.USER_ROLE_SERVICE); | |||
| this.config = this.appService.getConfig(); | |||
| this.production = Factory.getEmptyProduction(); | |||
| this.productionContacts = []; | |||
| this.productionContactsById = {}; | |||
| this.defaultColDef = { | |||
| resizable: true, | |||
| sortable: true | |||
| }; | |||
| this.columnDefs = [ | |||
| {headerName: 'Anrede', field: 'gender', width: 90 }, | |||
| {headerName: 'Vorname', field: 'firstname' }, | |||
| {headerName: 'Nachname', field: 'lastname' }, | |||
| {headerName: 'Abteilung', field: 'department' }, | |||
| {headerName: 'E-Mail Adresse', field: 'email', cellRenderer: this.emailRenderer }, | |||
| {headerName: 'Telefon', field: 'phone_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Mobil', field: 'mobile_no', cellRenderer: this.phoneRenderer }, | |||
| {headerName: 'Fax', field: 'fax_no' }, | |||
| {headerName: 'Straße', field: 'street' }, | |||
| {headerName: 'Hausnummer', field: 'street_no' }, | |||
| {headerName: 'PLZ', field: 'zip' }, | |||
| {headerName: 'Ort', field: 'city' }, | |||
| {headerName: 'Land', field: 'country' }, | |||
| {headerName: 'Bemerkungen', field: 'comment' } | |||
| ]; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param production | |||
| * @param isUpdate | |||
| */ | |||
| public setData(production: IProduction, isUpdate: boolean): void { | |||
| this.production = production; | |||
| this.productionContacts = this.production.v_production_contacts; | |||
| this.productionContactsById = Utils.getSortedObjFromArray(this.productionContacts, 'id'); | |||
| this.modalProductionContactPersonEdit.closeModal(); | |||
| this.generateEntries(); | |||
| if (isUpdate) { | |||
| this.productionContactPersonDetail.updateData(production); | |||
| } else { | |||
| this.modalProductionContactPersonDetail.closeModal(); | |||
| } | |||
| } | |||
| /** | |||
| * Generates AG grid entries | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| for (let i = 0; i < this.productionContacts.length; i++) { | |||
| let ocGender: string; | |||
| if (this.productionContacts[i].gender == 'male') { | |||
| ocGender = 'Herr'; | |||
| } else if (this.productionContacts[i].gender == 'female') { | |||
| ocGender = 'Frau'; | |||
| } else { | |||
| ocGender = 'Divers'; | |||
| } | |||
| this.rowData.push({ | |||
| id: this.productionContacts[i].id, | |||
| gender: ocGender, | |||
| firstname: this.productionContacts[i].firstname, | |||
| lastname: this.productionContacts[i].lastname, | |||
| department: this.productionContacts[i].department, | |||
| email: this.productionContacts[i].email, | |||
| phone_no: this.productionContacts[i].phone_no, | |||
| mobile_no: this.productionContacts[i].mobile_no, | |||
| fax_no: this.productionContacts[i].fax_no, | |||
| street: this.productionContacts[i].street, | |||
| street_no: this.productionContacts[i].street_no, | |||
| zip: this.productionContacts[i].zip, | |||
| city: this.productionContacts[i].city, | |||
| country: !isNull(this.productionContacts[i].country_id) ? this.config.vc_countries_by_id[this.productionContacts[i].country_id].name : null, | |||
| comment: this.productionContacts[i].comment, | |||
| }); | |||
| } | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalProductionContactPersonDetail.openModal(); | |||
| this.productionContactPersonDetail.setData(this.production, Utils.deepClone(this.productionContactsById[e.data.id]) as IProductionContact); | |||
| } | |||
| /** | |||
| * On create click | |||
| */ | |||
| public create(): void { | |||
| this.modalProductionContactPersonEdit.openModal(); | |||
| this.productionContactPersonEdit.setData(Factory.getEmptyProductionContact(this.production.id)); | |||
| } | |||
| /** | |||
| * Creates production contact | |||
| * @param productionContact | |||
| */ | |||
| public createProductionContactFunction(productionContact: IProductionContact): void { | |||
| this.createProductionContact.emit(productionContact); | |||
| } | |||
| /** | |||
| * Edit production contact | |||
| * @param productionContact | |||
| */ | |||
| public editProductionContactFunction(productionContact: IProductionContact): void { | |||
| this.editProductionContact.emit(productionContact); | |||
| } | |||
| /** | |||
| * Deletes production contact | |||
| * @param productionId | |||
| */ | |||
| public deleteProductionContactFunction(productionId: number): void { | |||
| this.deleteProductionContact.emit(productionId); | |||
| } | |||
| /** | |||
| * Shortcut to production detail | |||
| * @param production | |||
| */ | |||
| public shortcutFunction(production: IProduction): void { | |||
| this.modalProductionContactPersonDetail.closeModal(); | |||
| this.shortcut.emit(production); | |||
| } | |||
| } | |||
| @@ -1,120 +0,0 @@ | |||
| <h3 *ngIf="!isCreationMode">{{production.name}} bearbeiten</h3> | |||
| <h3 *ngIf="isCreationMode">Produzent anlegen</h3> | |||
| <form class="form" #productionDataForm="ngForm" (ngSubmit)="onFormSubmit(productionDataForm)"> | |||
| <div class="row row--full"> | |||
| <div class="column"> | |||
| <p class="error" *ngIf="errorMsg != ''">{{ errorMsg }}</p> | |||
| <p class="error-msg" *ngIf="odeName.invalid && odeName.touched && odeName?.errors?.required"> | |||
| Name ist ein Pflichtfeld. | |||
| </p> | |||
| <p *ngIf="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern" class="error-msg"> | |||
| Bitte gültige E-Mail Adresse eingeben. | |||
| </p> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column column--checkbox"> | |||
| <p class="label">Aktivität</p> | |||
| <input type="checkbox" id="odeActive" name="odeActive" [(ngModel)]="production.active" #odeActive="ngModel" /> | |||
| <label for="odeActive">Produzent ist aktiv</label> | |||
| </div> | |||
| </div> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeName" [class.error]="odeName.touched && odeName?.errors?.required"><strong>Name*</strong></label> | |||
| <input type="text" id="odeName" name="odeName" [(ngModel)]="production.name" required #odeName="ngModel" | |||
| placeholder="Musterfirma" [class.error]="odeName.touched && odeName?.errors?.required" /> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeAdditionalname">Zusatz</label> | |||
| <input type="text" id="odeAdditionalname" name="odeAdditionalname" [(ngModel)]="production.name_additional" #odeAdditionalname="ngModel" | |||
| placeholder="Die Muster-Agentur"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeStreet">Straße</label> | |||
| <input type="text" id="odeStreet" name="odeStreet" [(ngModel)]="production.street" | |||
| placeholder="Musterstraße" #odeStreet="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeStreetNo">Hausnummer</label> | |||
| <input type="text" id="odeStreetNo" name="odeStreetNo" [(ngModel)]="production.street_no" | |||
| placeholder="1a" #odeStreetNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeZip">PLZ</label> | |||
| <input type="text" id="odeZip" name="odeZip" [(ngModel)]="production.zip" | |||
| placeholder="12345" #odeZip="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeCity">Ort</label> | |||
| <input type="text" id="odeCity" name="odeCity" [(ngModel)]="production.city" | |||
| placeholder="Musterstadt" #odeCity="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeCountry">Land</label> | |||
| <select id="odeCountry" name="odeCountry" [(ngModel)]="production.country_id" #odeCountry="ngModel"> | |||
| <option [ngValue]=null>Land wählen</option> | |||
| <option *ngFor="let c of config.countries" value="{{ c.id }}">{{ c.name }}</option> | |||
| </select> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeUrl">Internetadresse</label> | |||
| <input type="text" id="odeUrl" name="odeUrl" [(ngModel)]="production.url" #odeUrl="ngModel" | |||
| placeholder="http://www.musterfirma.de"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeEmail" [class.error]="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern">E-Mail</label> | |||
| <input type="email" id="odeEmail" name="odeEmail" [(ngModel)]="production.email" #odeEmail="ngModel" | |||
| [class.error]="odeEmail.invalid && odeEmail.touched && odeEmail?.errors?.pattern" | |||
| placeholder="b.mustermann@musterfirma.de" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeComment">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="odeComment" name="odeComment" [(ngModel)]="production.comment" #odeComment="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odePhoneNo">Telefon</label> | |||
| <input type="text" id="odePhoneNo" name="odePhoneNo" [(ngModel)]="production.phone_no" | |||
| placeholder="040-1234567" #odePhoneNo="ngModel"/> | |||
| </div> | |||
| <div class="column"> | |||
| <label for="odeMobileNo">Mobil</label> | |||
| <input type="text" id="odeMobileNo" name="odeMobileNo" [(ngModel)]="production.mobile_no" | |||
| placeholder="0177-1234567" #odeMobileNo="ngModel"/> | |||
| </div> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="odeFaxNo">Fax</label> | |||
| <input type="text" id="odeFaxNo" name="odeFaxNo" [(ngModel)]="production.fax_no" | |||
| placeholder="040-1234568" #odeFaxNo="ngModel"/> | |||
| </div> | |||
| <div class="column"></div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!productionDataForm.valid" title="Produzent speichern" *ngIf="!isCreationMode">speichern</button> | |||
| <button class="button" [disabled]="!productionDataForm.valid" title="Produzent anlegen" *ngIf="isCreationMode">anlegen</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| @@ -1,71 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {isNull} from 'util'; | |||
| import {IProduction} from '../../../../model/entities/production'; | |||
| @Component({ | |||
| selector: 'app-production-data-edit', | |||
| templateUrl: './production-data-edit.component.html', | |||
| styleUrls: ['./production-data-edit.component.scss'] | |||
| }) | |||
| export class ProductionDataEditComponent extends FormComponent implements OnInit { | |||
| @Output() editProduction: EventEmitter<IProduction> = new EventEmitter<IProduction>(); | |||
| @Output() createProduction: EventEmitter<IProduction> = new EventEmitter<IProduction>(); | |||
| @ViewChild('productionDataForm', { static: true }) productionDataForm: NgForm; | |||
| public production: IProduction; | |||
| public config: IConfig; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| } | |||
| ngOnInit() { | |||
| this.production = Factory.getEmptyProduction(); | |||
| this.config = this.appService.getConfig(); | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param production | |||
| */ | |||
| public setData(production: IProduction): void { | |||
| this.production = production; | |||
| this.isCreationMode = isNull(this.production.id); | |||
| this.errorMsg = ''; | |||
| this.resetFormValidation(); | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(): void { | |||
| this.productionDataForm.form.markAsUntouched(); | |||
| } | |||
| /** | |||
| * Saves production | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if (valid) { | |||
| if (this.isCreationMode) { | |||
| this.createProduction.emit(this.production); | |||
| } else { | |||
| this.editProduction.emit(this.production); | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'production-data-modal' : 'production-data-edit-modal'); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,38 +0,0 @@ | |||
| <h3>Produzentendaten</h3> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Status:</dt> | |||
| <dd><span *ngIf="production.active">Aktiv</span><span *ngIf="!production.active">Inaktiv</span></dd> | |||
| <dt>Firma:</dt> | |||
| <dd>{{production.name}}<ng-container *ngIf="production.old_plp_id != null"> ({{production.old_plp_id}})</ng-container></dd> | |||
| <dt *ngIf="production.name_additional">Zusatz:</dt> | |||
| <dd *ngIf="production.name_additional">{{production.name_additional}}</dd> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{production.street}} {{production.street_no}}<br /> | |||
| {{production.zip}} {{production.city}} | |||
| <ng-container *ngIf="production.country_id"><br />{{config.vc_countries_by_id[production.country_id]['name']}}</ng-container></dd> | |||
| <dt *ngIf="checkedUrl">Internetadresse:</dt> | |||
| <dd *ngIf="checkedUrl"><a href="{{checkedUrl}}" target="_blank">{{checkedUrl}}</a></dd> | |||
| <dt *ngIf="production.email">E-Mail:</dt> | |||
| <dd *ngIf="production.email"><a href="mailto:{{production.email}}">{{production.email}}</a></dd> | |||
| <dt *ngIf="production.phone_no">Telefon:</dt> | |||
| <dd *ngIf="production.phone_no"><a href="tel:{{production.phone_no}}">{{production.phone_no}}</a></dd> | |||
| <dt *ngIf="production.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="production.mobile_no"><a href="tel:{{production.mobile_no}}">{{production.mobile_no}}</a></dd> | |||
| <dt *ngIf="production.fax_no">Fax:</dt> | |||
| <dd *ngIf="production.fax_no">{{production.fax_no}}</dd> | |||
| <dt *ngIf="production.comment">Bemerkung:</dt> | |||
| <dd class="pre-wrap" *ngIf="production.comment">{{production.comment}}</dd> | |||
| </dl> | |||
| </div> | |||
| <div class="grid-item"> | |||
| <div class="button button--inline right" (click)="edit()" *ngIf="hasEditRights">bearbeiten</div> | |||
| </div> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalProductionDataEdit> | |||
| <div id="production-data-edit-modal"> | |||
| <app-production-data-edit #productionDataEdit (editProduction)="editProductionFunction($event)"></app-production-data-edit> | |||
| </div> | |||
| </app-modal> | |||
| @@ -1,66 +0,0 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {ModalComponent} from '../../../../components/modal/modal.component'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {Const} from '../../../../utils/const'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| import {IProduction} from '../../../../model/entities/production'; | |||
| import {ProductionDataEditComponent} from '../production-data-edit/production-data-edit.component'; | |||
| @Component({ | |||
| selector: 'app-production-data-view', | |||
| templateUrl: './production-data-view.component.html', | |||
| styleUrls: ['./production-data-view.component.scss'] | |||
| }) | |||
| export class ProductionDataViewComponent implements OnInit { | |||
| @Output() editProduction: EventEmitter<IProduction> = new EventEmitter<IProduction>(); | |||
| @ViewChild('modalProductionDataEdit', { static: true }) modalProductionDataEdit: ModalComponent; | |||
| @ViewChild('productionDataEdit', { static: true }) productionDataEdit: ProductionDataEditComponent; | |||
| public production: IProduction; | |||
| public checkedUrl: string; | |||
| public config: IConfig; | |||
| public hasEditRights: boolean; | |||
| constructor(private appService: AppService) { } | |||
| ngOnInit() { | |||
| this.hasEditRights = | |||
| this.appService.userHasRole(Const.USER_ROLE_TECHNIQUE) || | |||
| this.appService.userHasRole(Const.USER_ROLE_PRODUCTION) || | |||
| this.appService.userHasRole(Const.USER_ROLE_SERVICE); | |||
| this.config = this.appService.getConfig(); | |||
| this.production = Factory.getEmptyProduction(); | |||
| this.checkedUrl = ''; | |||
| } | |||
| /** | |||
| * Sets data | |||
| * @param production | |||
| */ | |||
| public setData(production: IProduction): void { | |||
| this.production = production; | |||
| this.checkedUrl = Utils.checkUrl(this.production.url); | |||
| this.modalProductionDataEdit.closeModal(); | |||
| } | |||
| /** | |||
| * On edit click | |||
| */ | |||
| public edit(): void { | |||
| this.modalProductionDataEdit.openModal(); | |||
| this.productionDataEdit.setData(Utils.deepClone(this.production) as IProduction); | |||
| } | |||
| /** | |||
| * Saves production | |||
| * @param production | |||
| */ | |||
| public editProductionFunction(production: IProduction): void { | |||
| this.editProduction.emit(production); | |||
| } | |||
| } | |||
| @@ -1,77 +0,0 @@ | |||
| <div [hidden]="isEditMode"> | |||
| <h3>Termin mit Produzent: {{production.name}}</h3> | |||
| <h4>{{date}} {{timeStart}} Uhr bis {{timeEnd}} Uhr</h4> | |||
| <h3>{{productionMeeting.title}}</h3> | |||
| <h5>Erstellt von: {{creator.firstname}} {{creator.lastname}}</h5> | |||
| <p *ngIf="productionMeeting.description">{{productionMeeting.description}}</p> | |||
| <div class="grid"> | |||
| <div class="grid-item"> | |||
| <div class="grid-item"> | |||
| <dl> | |||
| <dt>Termin-Art:</dt> | |||
| <dd>{{meetingType.name}}</dd> | |||
| <dt>PLP Verantwortlicher:</dt> | |||
| <dd>{{owner.firstname}} {{owner.lastname}}</dd> | |||
| <dt>Teilnehmer:</dt> | |||
| <dd> | |||
| <ng-container *ngFor="let p of participants"> | |||
| {{p.firstname}} {{p.lastname}}<br /> | |||
| </ng-container> | |||
| </dd> | |||
| <ng-container *ngIf="meetingType.type == 'visit'"> | |||
| <dt>Adresse:</dt> | |||
| <dd>{{productionMeeting.street}} {{productionMeeting.street_no}}<br /> | |||
| {{productionMeeting.zip}} {{productionMeeting.city}} | |||
| <ng-container *ngIf="productionMeeting.country_id != null"><br />{{config.vc_countries_by_id[productionMeeting.country_id]['name']}}</ng-container></dd> | |||
| </ng-container> | |||
| <dt>Gesprächspartner:</dt> | |||
| <dd><span *ngIf="productionMeeting.gender == 'male'">Herr </span> | |||
| <span *ngIf="productionMeeting.gender == 'female'">Frau </span> | |||
| <span *ngIf="productionMeeting.gender == 'diverse'">Divers </span>{{productionMeeting.firstname}} {{productionMeeting.lastname}}</dd> | |||
| <dt *ngIf="productionMeeting.department">Abteilung:</dt> | |||
| <dd *ngIf="productionMeeting.department">{{productionMeeting.department}}</dd> | |||
| <dt *ngIf="productionMeeting.email">E-Mail:</dt> | |||
| <dd *ngIf="productionMeeting.email"><a href="mailto:{{productionMeeting.email}}">{{productionMeeting.email}}</a></dd> | |||
| <dt *ngIf="productionMeeting.phone_no">Telefon:</dt> | |||
| <dd *ngIf="productionMeeting.phone_no"><a href="tel:{{productionMeeting.phone_no}}">{{productionMeeting.phone_no}}</a></dd> | |||
| <dt *ngIf="productionMeeting.mobile_no">Mobil:</dt> | |||
| <dd *ngIf="productionMeeting.mobile_no"><a href="tel:{{productionMeeting.mobile_no}}">{{productionMeeting.mobile_no}}</a></dd> | |||
| <dt *ngIf="reportOld != null && reportOld != ''">Report:</dt> | |||
| <dd *ngIf="reportOld != null && reportOld != ''">{{reportOld}}</dd> | |||
| </dl> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="form"*ngIf="hasEditRights"> | |||
| <div class="row row--last"> | |||
| <div class="column"> | |||
| <div class="button button--inline" (click)="editEntry()" *ngIf="productionMeeting.v_is_editable">Eintrag bearbeiten</div> | |||
| <div class="button button--inline" (click)="deleteEntry()" *ngIf="productionMeeting.v_is_editable">Eintrag löschen</div> | |||
| <div class="button button--inline" (click)="editReport()" *ngIf="hasReportRights && !reportFormVisible">Report bearbeiten</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div id="production-meeting-edit-report" *ngIf="hasEditRights || appService.getAppUser().id == productionMeeting.owner_user_id"> | |||
| <form class="form" #productionMeetingReportForm="ngForm" (ngSubmit)="onFormSubmit(productionMeetingReportForm)" *ngIf="reportFormVisible"> | |||
| <div *ngIf="errorMsg != ''" class="row row--full"> | |||
| <p class="error">{{ errorMsg }}</p> | |||
| </div> | |||
| <div class="row"> | |||
| <div class="column"> | |||
| <label for="cmdReport">Bemerkungen</label> | |||
| <textarea rows="5" cols="50" id="cmdReport" name="cmdReport" [(ngModel)]="productionMeeting.report" #cmdReport="ngModel"></textarea> | |||
| </div> | |||
| </div> | |||
| <div class="row row--full row--last"> | |||
| <div class="column"> | |||
| <button class="button" [disabled]="!productionMeetingReportForm.valid" title="Report speichern">Report speichern</button> | |||
| </div> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| <div [hidden]="!isEditMode"> | |||
| <div id="production-meeting-edit-modal"> | |||
| <app-production-meeting-edit #productionMeetingDetailEdit (editMeeting)="editProductionMeetingFunction($event)"></app-production-meeting-edit> | |||
| </div> | |||
| </div> | |||