| @@ -11,23 +11,25 @@ | |||
| }, | |||
| "private": true, | |||
| "dependencies": { | |||
| "@angular-devkit/build-angular": "^16.0.0", | |||
| "@angular-devkit/schematics": "^16.0.0", | |||
| "@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", | |||
| "@angular-devkit/build-angular": "^15.2.8", | |||
| "@angular-devkit/schematics": "^15.2.8", | |||
| "@angular/animations": "^15.2.8", | |||
| "@angular/common": "^15.2.8", | |||
| "@angular/compiler": "^15.2.8", | |||
| "@angular/core": "^15.2.8", | |||
| "@angular/forms": "^15.2.8", | |||
| "@angular/platform-browser": "^15.2.8", | |||
| "@angular/platform-browser-dynamic": "^15.2.8", | |||
| "@angular/router": "^15.2.8", | |||
| "@ng-bootstrap/ng-bootstrap": "^14.1.1", | |||
| "ag-grid-angular": "^21.2.2", | |||
| "ag-grid-community": "^21.2.2", | |||
| "@npmcli/fs": "^3.1.0", | |||
| "ag-grid-angular": "^29.3.5", | |||
| "ag-grid-community": "^29.3.5", | |||
| "angular-calendar": "^0.31.0", | |||
| "angularx-flatpickr": "^6.2.0", | |||
| "codelyzer": "^6.0.2", | |||
| "date-fns": "^1.30.1", | |||
| "eslint": "^8.40.0", | |||
| "file-saver": "^2.0.2", | |||
| "flatpickr": "^4.6.13", | |||
| "ng6-breadcrumbs": "^1.0.7", | |||
| @@ -36,13 +38,13 @@ | |||
| "zone.js": "~0.13.0" | |||
| }, | |||
| "devDependencies": { | |||
| "@angular/cli": "^16.0.0", | |||
| "@angular/compiler-cli": "^16.0.0", | |||
| "@angular/language-service": "^16.0.0", | |||
| "@angular/cli": "^15.2.8", | |||
| "@angular/compiler-cli": "^15.2.8", | |||
| "@angular/language-service": "^15.2.8", | |||
| "@types/file-saver": "^2.0.1", | |||
| "@types/jasmine": "~3.3.8", | |||
| "@types/jasminewd2": "^2.0.8", | |||
| "@types/node": "~8.9.4", | |||
| "@types/node": "^20.1.5", | |||
| "jasmine-core": "~3.8.0", | |||
| "jasmine-spec-reporter": "~5.0.0", | |||
| "karma": "^6.4.2", | |||
| @@ -50,9 +52,7 @@ | |||
| "karma-coverage-istanbul-reporter": "~3.0.2", | |||
| "karma-jasmine": "~4.0.0", | |||
| "karma-jasmine-html-reporter": "^1.5.0", | |||
| "protractor": "^7.0.0", | |||
| "ts-node": "~7.0.0", | |||
| "tslint": "~6.1.0", | |||
| "typescript": "~4.9.5" | |||
| } | |||
| } | |||
| @@ -7,9 +7,6 @@ import {RouteInterceptor} from './interceptor/route-interceptor'; | |||
| import {AccountingComponent} from './views/accounting/accounting.component'; | |||
| import {TechniqueComponent} from './views/technique/technique.component'; | |||
| import {SalesComponent} from './views/sales/sales.component'; | |||
| import {OperatorsComponent} from './views/operators/operators.component'; | |||
| import {ProductionsComponent} from './views/productions/productions.component'; | |||
| import {ServicesComponent} from './views/services/services.component'; | |||
| const routes: Routes = [ | |||
| @@ -17,9 +14,6 @@ const routes: Routes = [ | |||
| {path: 'login', component: LoginComponent, data: {breadcrumb: 'Login'}}, | |||
| {path: 'start', component: StartComponent, data: {breadcrumb: 'Home'}, canActivate: [RouteInterceptor]}, | |||
| {path: 'customer-management', component: CustomerManagementComponent, data: {breadcrumb: 'Kunden'}, canActivate: [RouteInterceptor]}, | |||
| {path: 'operators', component: OperatorsComponent, data: {breadcrumb: 'Betreiber'}, canActivate: [RouteInterceptor]}, | |||
| {path: 'productions', component: ProductionsComponent, data: {breadcrumb: 'Produzenten'}, canActivate: [RouteInterceptor]}, | |||
| {path: 'service', component: ServicesComponent, data: {breadcrumb: 'Service'}, canActivate: [RouteInterceptor]}, | |||
| // {path: 'accounting', component: AccountingComponent, data: {breadcrumb: 'Buchhaltung'}, canActivate: [RouteInterceptor]}, | |||
| // {path: 'technique', component: TechniqueComponent, data: {breadcrumb: 'Technik'}, canActivate: [RouteInterceptor]}, | |||
| // {path: 'sales', component: SalesComponent, data: {breadcrumb: 'Vertrieb'}, canActivate: [RouteInterceptor]}, | |||
| @@ -39,10 +33,7 @@ export const routingComponents = [ | |||
| LoginComponent, | |||
| StartComponent, | |||
| CustomerManagementComponent, | |||
| OperatorsComponent, | |||
| AccountingComponent, | |||
| ProductionsComponent, | |||
| ServicesComponent, | |||
| TechniqueComponent, | |||
| SalesComponent, | |||
| ]; | |||
| @@ -1,6 +1,5 @@ | |||
| <div id="wrapper"> | |||
| <header id="header"> | |||
| <breadcrumb></breadcrumb> | |||
| <div class="user" *ngIf="activeUser != null">{{activeUser.firstname}} {{activeUser.lastname}} ({{activeUser.v_translated_role}})</div> | |||
| </header> | |||
| <div id="content"> | |||
| @@ -6,7 +6,6 @@ import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap'; | |||
| import {AppRoutingModule, routingComponents} from './app-routing.module'; | |||
| import { AppComponent } from './app.component'; | |||
| import { StartComponent } from './views/start/start.component'; | |||
| import {BreadcrumbsModule} from 'ng6-breadcrumbs'; | |||
| import { BrowserAnimationsModule} from '@angular/platform-browser/animations'; | |||
| import {CalendarModule, DateAdapter} from 'angular-calendar'; | |||
| import { adapterFactory} from 'angular-calendar/date-adapters/date-fns'; | |||
| @@ -38,7 +37,6 @@ import { CustomerContactPersonEditComponent } from './views/customer-management/ | |||
| import { CustomerNoteViewComponent } from './views/customer-management/customer-view/customer-note-view/customer-note-view.component'; | |||
| import { CustomerNoteEditComponent } from './views/customer-management/customer-view/customer-note-edit/customer-note-edit.component'; | |||
| import {CustomerService} from './services/customer.service'; | |||
| import { ScrollToModule } from '@nicky-lenaers/ngx-scroll-to'; | |||
| import { CustomerNoteDetailComponent } from './views/customer-management/customer-view/customer-note-detail/customer-note-detail.component'; | |||
| import {GridCheckboxRendererComponent} from './grid-cellrenderer/grid-checkbox/grid-checkbox-renderer/grid-checkbox-renderer.component'; | |||
| import {GridCheckboxEditorComponent} from './grid-cellrenderer/grid-checkbox/grid-checkbox-editor/grid-checkbox-editor.component'; | |||
| @@ -61,11 +59,12 @@ import { CustomerContactListComponent } from './views/customer-management/custom | |||
| import { MeetingListComponent } from './views/start/meeting-list/meeting-list.component'; | |||
| import { MeetingCalendarComponent } from './views/start/meeting-calendar/meeting-calendar.component'; | |||
| import { CustomerContactPersonDetailComponent } from './views/customer-management/customer-view/customer-contact-person-detail/customer-contact-person-detail.component'; | |||
| 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 { CalendarLegendComponent } from './components/calendar-legend/calendar-legend.component'; | |||
| import { CommonService } from './services/common.service'; | |||
| import {GridRendererComponent} from './grid-cellrenderer/grid-renderer-component'; | |||
| import {GridEditorComponent} from './grid-cellrenderer/grid-editor-component'; | |||
| registerLocaleData(localeDe); | |||
| @@ -92,6 +91,8 @@ registerLocaleData(localeDe); | |||
| CustomerNoteViewComponent, | |||
| CustomerNoteEditComponent, | |||
| CustomerNoteDetailComponent, | |||
| GridRendererComponent, | |||
| GridEditorComponent, | |||
| GridCheckboxRendererComponent, | |||
| GridCheckboxEditorComponent, | |||
| GridSelectEditorComponent, | |||
| @@ -124,23 +125,15 @@ registerLocaleData(localeDe); | |||
| FlatpickrModule.forRoot(), | |||
| AppRoutingModule, | |||
| HttpClientModule, | |||
| BreadcrumbsModule, | |||
| ReactiveFormsModule, | |||
| FormsModule, | |||
| BrowserAnimationsModule, | |||
| ScrollToModule.forRoot(), | |||
| // ScrollToModule.forRoot(), | |||
| CalendarModule.forRoot({ | |||
| provide: DateAdapter, | |||
| useFactory: adapterFactory | |||
| }), | |||
| AgGridModule.withComponents([ | |||
| GridCheckboxRendererComponent, GridCheckboxEditorComponent, | |||
| GridSelectRendererComponent, GridSelectEditorComponent, | |||
| GridDateRendererComponent, GridDateEditorComponent, | |||
| GridInputRendererComponent, GridInputEditorComponent, | |||
| GridTextRendererComponent, GridTextEditorComponent, | |||
| GridBlockedRendererComponent, GridBlockedEditorComponent | |||
| ]) | |||
| AgGridModule, | |||
| ], | |||
| providers: [ | |||
| AppService, | |||
| @@ -148,8 +141,7 @@ registerLocaleData(localeDe); | |||
| CacheService, | |||
| MessageService, | |||
| HttpService, | |||
| CustomerService | |||
| MeetingService, | |||
| CustomerService, | |||
| CommonService, | |||
| {provide: HTTP_INTERCEPTORS, useClass: HttpClientInterceptor, multi: true}, | |||
| ], | |||
| @@ -1,4 +1,3 @@ | |||
| import {isUndefined} from 'util'; | |||
| import {path} from '../../environments/path'; | |||
| import {AgGridLocale} from '../lang/ag-gridlocale'; | |||
| import {IGridValidationErrors} from '../model/virtual/grid-validation-errors'; | |||
| @@ -128,7 +127,7 @@ export class AgGridComponent { | |||
| * Resizes grid | |||
| */ | |||
| public gridSizeChanged(params: any): void { | |||
| if (!isUndefined(this.gridParamsApi)) { | |||
| if (undefined !== this.gridParamsApi) { | |||
| this.gridParamsApi.sizeColumnsToFit(); | |||
| } | |||
| } | |||
| @@ -202,8 +201,8 @@ export class AgGridComponent { | |||
| const errors: IGridValidationErrors[] = []; | |||
| primaryColumns.forEach((value) => { | |||
| if (!isUndefined(value.colDef.cellEditorParams)) { | |||
| if (!isUndefined(value.colDef.cellEditorParams.mandatory) && value.colDef.cellEditorParams.mandatory === true) { | |||
| if (undefined !== value.colDef.cellEditorParams) { | |||
| if (undefined !== value.colDef.cellEditorParams.mandatory && true === value.colDef.cellEditorParams.mandatory) { | |||
| errorColumn.push(value.colDef.field); | |||
| } | |||
| } | |||
| @@ -211,7 +210,7 @@ export class AgGridComponent { | |||
| errorColumn.forEach((value, i) => { | |||
| this.params.api.forEachNode((rowNode, index) => { | |||
| if (null === rowNode.data[value] || isUndefined(rowNode.data[value])) { | |||
| if (null === rowNode.data[value] || undefined === rowNode.data[value]) { | |||
| errors.push({ | |||
| column: value, | |||
| row: index | |||
| @@ -1,13 +1,18 @@ | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| export class FormComponent { | |||
| public errorMsg: string; | |||
| public isCreationMode: boolean; | |||
| protected scrollToService: ScrollToService; | |||
| // protected scrollToService: ScrollToService; | |||
| constructor(scrollToService: ScrollToService) { | |||
| this.scrollToService = scrollToService; | |||
| // constructor(scrollToService: ScrollToService) { | |||
| // this.scrollToService = scrollToService; | |||
| // this.errorMsg = ''; | |||
| // this.isCreationMode = false; | |||
| // } | |||
| constructor() { | |||
| this.errorMsg = ''; | |||
| this.isCreationMode = false; | |||
| } | |||
| @@ -26,7 +31,7 @@ export class FormComponent { | |||
| /** | |||
| * Configures scrollToService - https://www.npmjs.com/package/@nicky-lenaers/ngx-scroll-to | |||
| */ | |||
| public scrollUp(identifier: string): void { | |||
| this.scrollToService.scrollTo({target: identifier}); | |||
| } | |||
| // public scrollUp(identifier: string): void { | |||
| // this.scrollToService.scrollTo({target: identifier}); | |||
| // } | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| import {AfterContentInit, Component, EventEmitter, OnInit, Input, Output, Renderer2} from '@angular/core'; | |||
| @Component({ | |||
| selector: 'app-modal', | |||
| selector: 'app-spt-modal', | |||
| templateUrl: './modal.component.html', | |||
| styleUrls: ['./modal.component.scss'] | |||
| }) | |||
| @@ -52,7 +52,6 @@ export class ModalComponent implements OnInit, AfterContentInit { | |||
| /** | |||
| * Closes modal dialog with confirm message | |||
| * @param {string} message | |||
| */ | |||
| public closeWithConfirm(message: string): boolean { | |||
| if (confirm(message)) { | |||
| @@ -73,7 +72,6 @@ export class ModalComponent implements OnInit, AfterContentInit { | |||
| /** | |||
| * Returns if modal is open | |||
| * @returns {boolean} | |||
| */ | |||
| public isOpen(): boolean { | |||
| return this.showModal; | |||
| @@ -7,18 +7,6 @@ import {IUser} from '../model/entities/user'; | |||
| import {IMeetingType} from '../model/entities/meeting-type'; | |||
| import {IInternalMeeting} from '../model/entities/internal-meeting'; | |||
| import {Utils} from '../utils/utils'; | |||
| import {IOperator} from '../model/entities/operator'; | |||
| import {IOperatorContact} from '../model/entities/operator-contact'; | |||
| import {IOperatorNote} from '../model/entities/operator-note'; | |||
| import {IOperatorMeeting} from '../model/entities/operator-meeting'; | |||
| import {IProduction} from '../model/entities/production'; | |||
| import {IProductionContact} from '../model/entities/production-contact'; | |||
| import {IProductionNote} from '../model/entities/production-note'; | |||
| import {IProductionMeeting} from '../model/entities/production-meeting'; | |||
| import {IService} from '../model/entities/service'; | |||
| import {IServiceContact} from '../model/entities/service-contact'; | |||
| import {IServiceNote} from '../model/entities/service-note'; | |||
| import {IServiceMeeting} from '../model/entities/service-meeting'; | |||
| export class Factory { | |||
| static getEmptyUser(): IUser { | |||
| @@ -34,14 +22,6 @@ export class Factory { | |||
| /** | |||
| * Returns empty message | |||
| * @param errorCode | |||
| * @param errorMsg | |||
| * @param successCode | |||
| * @param successMsg | |||
| * @param infoCode | |||
| * @param infoMsg | |||
| * @param clientErrorCode | |||
| * @param optionalInfo | |||
| */ | |||
| static getEmptyMessage(errorCode: number, errorMsg: string, successCode: number, successMsg: string, | |||
| infoCode: number, infoMsg: string, clientErrorCode: number, optionalInfo: string = null): IMessage { | |||
| @@ -173,348 +153,6 @@ export class Factory { | |||
| return emptyCustomerMeeting as ICustomerMeeting; | |||
| } | |||
| /** | |||
| * Returns empty operator | |||
| */ | |||
| static getEmptyOperator(): IOperator { | |||
| const emptyOperator: {} = { | |||
| id: null, | |||
| old_plp_id: null, | |||
| name: null, | |||
| name_additional: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| url: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| tax_no: null, | |||
| invoice_mode: null, | |||
| invoice_comment: null, | |||
| invoice_key: null, | |||
| comment: null, | |||
| active: true, | |||
| }; | |||
| return emptyOperator as IOperator; | |||
| } | |||
| /** | |||
| * Returns empty operator contact person | |||
| */ | |||
| static getEmptyOperatorContact(operatorId: number = null): IOperatorContact { | |||
| const emptyOperatorContact: {} = { | |||
| id: null, | |||
| operator_id: operatorId, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| date_of_birth: null, | |||
| comment: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| is_xmas_mail_recipient: false, | |||
| }; | |||
| return emptyOperatorContact as IOperatorContact; | |||
| } | |||
| static getEmptyOperatorNote(operatorId: number = null, noteDate: string = null): IOperatorNote { | |||
| const emptyOperatorNote: {} = { | |||
| id: operatorId, | |||
| operator_id: null, | |||
| operator_contact_id: null, | |||
| user_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| title: null, | |||
| comment: null, | |||
| note_date: noteDate, | |||
| creation_date: null, | |||
| creation_user_id: null, | |||
| creation_user_firstname: null, | |||
| creation_user_lastname: null | |||
| }; | |||
| return emptyOperatorNote as IOperatorNote; | |||
| } | |||
| static getEmptyOperatorMeeting(operatorId: number = null): IOperatorMeeting { | |||
| const emptyOperatorMeeting: {} = { | |||
| id: null, | |||
| operator_id: operatorId, | |||
| operator_user_id: null, | |||
| owner_user_id: null, | |||
| meeting_type_id: null, | |||
| is_option_meeting: false, | |||
| title: null, | |||
| description: null, | |||
| start_date: Utils.getCurrentDate() + ' 09:00:00', | |||
| end_date: Utils.getCurrentDate() + ' 18:00:00', | |||
| operator_contact_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| department: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| report: null, | |||
| first_reminder_sent: false, | |||
| second_reminder_sent: false, | |||
| report_done: false, | |||
| report_reminder_sent: false, | |||
| creation_date: null, | |||
| v_participants: [], | |||
| v_is_editable: true | |||
| }; | |||
| return emptyOperatorMeeting as IOperatorMeeting; | |||
| } | |||
| static getEmptyProduction(): IProduction { | |||
| const emptyProduction: {} = { | |||
| id: null, | |||
| old_plp_id: null, | |||
| name: null, | |||
| name_additional: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| url: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| tax_no: null, | |||
| invoice_mode: null, | |||
| invoice_comment: null, | |||
| invoice_key: null, | |||
| comment: null, | |||
| active: true, | |||
| }; | |||
| return emptyProduction as IProduction; | |||
| } | |||
| static getEmptyProductionContact(productionId: number = null): IProductionContact { | |||
| const emptyProductionContact: {} = { | |||
| id: null, | |||
| production_id: productionId, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| date_of_birth: null, | |||
| comment: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| is_xmas_mail_recipient: false, | |||
| }; | |||
| return emptyProductionContact as IProductionContact; | |||
| } | |||
| static getEmptyProductionNote(productionId: number = null, noteDate: string = null): IProductionNote { | |||
| const emptyProductionNote: {} = { | |||
| id: productionId, | |||
| production_id: null, | |||
| production_contact_id: null, | |||
| user_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| title: null, | |||
| comment: null, | |||
| note_date: noteDate, | |||
| creation_date: null, | |||
| creation_user_id: null, | |||
| creation_user_firstname: null, | |||
| creation_user_lastname: null | |||
| }; | |||
| return emptyProductionNote as IProductionNote; | |||
| } | |||
| static getEmptyProductionMeeting(productionId: number = null): IProductionMeeting { | |||
| const emptyProductionMeeting: {} = { | |||
| id: null, | |||
| production_id: productionId, | |||
| production_user_id: null, | |||
| owner_user_id: null, | |||
| meeting_type_id: null, | |||
| is_option_meeting: false, | |||
| title: null, | |||
| description: null, | |||
| start_date: Utils.getCurrentDate() + ' 09:00:00', | |||
| end_date: Utils.getCurrentDate() + ' 18:00:00', | |||
| production_contact_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| department: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| report: null, | |||
| first_reminder_sent: false, | |||
| second_reminder_sent: false, | |||
| report_done: false, | |||
| report_reminder_sent: false, | |||
| creation_date: null, | |||
| v_participants: [], | |||
| v_is_editable: true | |||
| }; | |||
| return emptyProductionMeeting as IProductionMeeting; | |||
| } | |||
| static getEmptyService(): IService { | |||
| const emptyService: {} = { | |||
| id: null, | |||
| old_plp_id: null, | |||
| name: null, | |||
| name_additional: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| url: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| tax_no: null, | |||
| invoice_mode: null, | |||
| invoice_comment: null, | |||
| invoice_key: null, | |||
| comment: null, | |||
| active: true, | |||
| }; | |||
| return emptyService as IService; | |||
| } | |||
| static getEmptyServiceContact(serviceId: number = null): IServiceContact { | |||
| const emptyServiceContact: {} = { | |||
| id: null, | |||
| service_id: serviceId, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| date_of_birth: null, | |||
| comment: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| is_xmas_mail_recipient: false, | |||
| }; | |||
| return emptyServiceContact as IServiceContact; | |||
| } | |||
| static getEmptyServiceNote(serviceId: number = null, noteDate: string = null): IServiceNote { | |||
| const emptyProductionNote: {} = { | |||
| id: serviceId, | |||
| service_id: null, | |||
| service_contact_id: null, | |||
| user_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| fax_no: null, | |||
| department: null, | |||
| title: null, | |||
| comment: null, | |||
| note_date: noteDate, | |||
| creation_date: null, | |||
| creation_user_id: null, | |||
| creation_user_firstname: null, | |||
| creation_user_lastname: null | |||
| }; | |||
| return emptyProductionNote as IServiceNote; | |||
| } | |||
| static getEmptyServiceMeeting(serviceId: number = null): IServiceMeeting { | |||
| const emptyServiceMeeting: {} = { | |||
| id: null, | |||
| service_id: serviceId, | |||
| service_user_id: null, | |||
| owner_user_id: null, | |||
| meeting_type_id: null, | |||
| is_option_meeting: false, | |||
| title: null, | |||
| description: null, | |||
| start_date: Utils.getCurrentDate() + ' 09:00:00', | |||
| end_date: Utils.getCurrentDate() + ' 18:00:00', | |||
| service_contact_id: null, | |||
| gender: null, | |||
| firstname: null, | |||
| lastname: null, | |||
| email: null, | |||
| phone_no: null, | |||
| mobile_no: null, | |||
| department: null, | |||
| street: null, | |||
| street_no: null, | |||
| zip: null, | |||
| city: null, | |||
| country_id: null, | |||
| report: null, | |||
| first_reminder_sent: false, | |||
| second_reminder_sent: false, | |||
| report_done: false, | |||
| report_reminder_sent: false, | |||
| creation_date: null, | |||
| v_participants: [], | |||
| v_is_editable: true | |||
| }; | |||
| return emptyServiceMeeting as IServiceMeeting; | |||
| } | |||
| static getEmptyInternalMeeting(): IInternalMeeting { | |||
| const emptyInternalMeeting: {} = { | |||
| id: null, | |||
| @@ -1,5 +1,4 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {isUndefined} from 'util'; | |||
| import {GridRendererComponent} from '../../grid-renderer-component'; | |||
| @Component({ | |||
| @@ -14,12 +13,11 @@ export class GridDateRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| let tempValue: string[] = []; | |||
| if (null === this.value || isUndefined(this.value)) { | |||
| if (null === this.value || undefined === this.value) { | |||
| this.displayedValue = ''; | |||
| } else { | |||
| tempValue = this.value.split('-'); | |||
| @@ -1,8 +1,13 @@ | |||
| import {ElementRef, OnInit, ViewChild} from '@angular/core'; | |||
| import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; | |||
| import {ICellEditorAngularComp} from 'ag-grid-angular'; | |||
| import {IGridCellParams} from './grid-cell-params'; | |||
| @Component({ | |||
| template: '', | |||
| }) | |||
| export class GridEditorComponent implements OnInit, ICellEditorAngularComp { | |||
| @ViewChild('editorInput', { static: true }) inputField: ElementRef; | |||
| readonly GRID_ERROR_EMPTY: string = 'Bitte geben Sie einen Wert ein.'; | |||
| @@ -25,7 +30,6 @@ export class GridEditorComponent implements OnInit, ICellEditorAngularComp { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| this.params = params; | |||
| @@ -47,7 +51,6 @@ export class GridEditorComponent implements OnInit, ICellEditorAngularComp { | |||
| /** | |||
| * Cancels before value input (this editor is never editable) | |||
| * @returns {boolean} | |||
| */ | |||
| public isCancelBeforeStart(): boolean { | |||
| return false; | |||
| @@ -55,7 +58,6 @@ export class GridEditorComponent implements OnInit, ICellEditorAngularComp { | |||
| /** | |||
| * Cancels input of inserted value under certain conditions | |||
| * @returns {boolean} | |||
| */ | |||
| isCancelAfterEnd(): boolean { | |||
| return false; | |||
| @@ -63,7 +65,6 @@ export class GridEditorComponent implements OnInit, ICellEditorAngularComp { | |||
| /** | |||
| * Changes value on click | |||
| * @param e | |||
| */ | |||
| public valueIsChanged = (e) => { | |||
| this.value = e.srcElement.value; | |||
| @@ -3,13 +3,6 @@ import {IGridCellParams} from './grid-cell-params'; | |||
| export class GridFactory { | |||
| /** | |||
| * Returns param object for cell renderer and -editors | |||
| * @param {string} type | |||
| * @param {number} min | |||
| * @param {number} max | |||
| * @param {string} unit | |||
| * @param {boolean} mandatory | |||
| * @param {number} altValue | |||
| * @returns {IGridCellParams} | |||
| */ | |||
| static getGridCellParams(type: string = null, min: number = null, | |||
| max: number = null, unit: string = null, | |||
| @@ -12,7 +12,6 @@ import {Utils} from '../../../utils/utils'; | |||
| export class GridInputEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| @@ -37,7 +36,6 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Cancels input of inserted value under certain conditions | |||
| * @returns {boolean} | |||
| */ | |||
| isCancelAfterEnd(): boolean { | |||
| if (this.cellParams.mandatory && (null === this.value || this.value.toString().trim() === '')) { | |||
| @@ -46,20 +44,20 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| return true; | |||
| } | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_INT && !Utils.isInteger(this.value)) { | |||
| if (this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_INT && !Utils.isInteger(this.value)) { | |||
| // No int value given | |||
| AgGridComponentConst.setGridInputError(this.GRID_ERROR_INT); | |||
| return true; | |||
| } | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT && !Utils.isFloat(this.value)) { | |||
| if (this.cellParams.type === AgGridComponentConst.CELL_VALUE_TYPE_FLOAT && !Utils.isFloat(this.value)) { | |||
| // No float value given | |||
| AgGridComponentConst.setGridInputError(this.GRID_ERROR_FLOAT); | |||
| return true; | |||
| } | |||
| if (this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_INT || | |||
| this.cellParams.type == AgGridComponentConst.CELL_VALUE_TYPE_FLOAT) { | |||
| 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 (null !== this.cellParams.min && numericVal < Number(this.cellParams.min)) { | |||
| // Check on alternative value | |||
| @@ -101,7 +99,7 @@ export class GridInputEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Changes value on click | |||
| * @param e | |||
| * todo maybe this should get refacotred properly? | |||
| */ | |||
| public valueIsChanged = (e) => { | |||
| this.value = e.srcElement.value; | |||
| @@ -11,7 +11,6 @@ import {AgGridComponentConst} from '../../../components/ag-grid-component-const' | |||
| export class GridInputRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| @@ -1,8 +1,13 @@ | |||
| import {OnInit} from '@angular/core'; | |||
| import {Component, OnInit} from '@angular/core'; | |||
| import {ICellRendererAngularComp} from 'ag-grid-angular'; | |||
| import {IGridCellParams} from './grid-cell-params'; | |||
| @Component({ | |||
| template: '', | |||
| }) | |||
| export class GridRendererComponent implements OnInit, ICellRendererAngularComp { | |||
| public value: any; | |||
| public params: any; | |||
| public cellParams: IGridCellParams; | |||
| @@ -16,7 +21,6 @@ export class GridRendererComponent implements OnInit, ICellRendererAngularComp { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| this.params = params; | |||
| @@ -30,7 +34,6 @@ export class GridRendererComponent implements OnInit, ICellRendererAngularComp { | |||
| /** | |||
| * Sets value | |||
| * @param value | |||
| */ | |||
| setValue(value: any): void { | |||
| this.value = value; | |||
| @@ -38,7 +41,6 @@ export class GridRendererComponent implements OnInit, ICellRendererAngularComp { | |||
| /** | |||
| * Refreshes cell - Gets called after editing | |||
| * @param params | |||
| */ | |||
| refresh(params: any): boolean { | |||
| return false; | |||
| @@ -1,6 +1,5 @@ | |||
| import {Component} from '@angular/core'; | |||
| import {IGridSelectItem} from '../grid-select-item'; | |||
| import {isUndefined} from 'util'; | |||
| import {GridEditorComponent} from '../../grid-editor-component'; | |||
| import {GridSelectFactory} from '../grid-select-factory'; | |||
| import {IGridCellEditorParams} from '../../grid-cell-editor-params'; | |||
| @@ -37,7 +36,7 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| const itemRange: any[] = (params.node.data.hasOwnProperty(relatedValue) && null !== params.node.data[relatedValue]) ? | |||
| cellEditorParams.values[params.node.data[relatedValue]] : null; | |||
| if (null !== itemRange && !isUndefined(itemRange)) { | |||
| if (null !== itemRange && undefined !== itemRange) { | |||
| itemRange.forEach(item => { | |||
| this.values.push(GridSelectFactory.getGridSelectItem(item, this.itemKey, this.itemValueKeys)); | |||
| }); | |||
| @@ -47,17 +46,17 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| // Filter all items used by other selects (compareData) | |||
| const compareExcludeKey: string = cellEditorParams.exclusiveCompareDataKey; | |||
| const excludedItemKeys: {} = {}; | |||
| for (let i = 0; i < cellEditorParams.exclusiveCompareData.length; i++) { | |||
| if (cellEditorParams.exclusiveCompareData[i][compareExcludeKey] != this.value) { | |||
| excludedItemKeys[cellEditorParams.exclusiveCompareData[i][compareExcludeKey]] = 1; | |||
| cellEditorParams.exclusiveCompareData.forEach(item => { | |||
| if (item[compareExcludeKey] !== this.value) { | |||
| excludedItemKeys[item[compareExcludeKey]] = 1; | |||
| } | |||
| } | |||
| }); | |||
| // This select contains only values that are not selected by other selects and it's own current item | |||
| for (let h = 0; h < cellEditorParams.values.length; h++) { | |||
| if (!excludedItemKeys.hasOwnProperty(cellEditorParams.values[h][this.itemKey])) { | |||
| this.values.push(GridSelectFactory.getGridSelectItem(cellEditorParams.values[h], this.itemKey, this.itemValueKeys)); | |||
| cellEditorParams.values.forEach(item => { | |||
| if (!excludedItemKeys.hasOwnProperty(item[this.itemKey])) { | |||
| this.values.push(GridSelectFactory.getGridSelectItem(item, this.itemKey, this.itemValueKeys)); | |||
| } | |||
| } | |||
| }); | |||
| } else { | |||
| // Static values (default behaviour) | |||
| this.values = params.values; | |||
| @@ -74,13 +73,12 @@ export class GridSelectEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Makes selectItem out of ID | |||
| * @param e | |||
| */ | |||
| public getSelectedItem(e: any): IGridSelectItem { | |||
| if (e != null && e != '') { | |||
| for (let i = 0; i < this.values.length; i++) { | |||
| if (this.values[i].key == e) { | |||
| this.newValue = this.values[i]; | |||
| if (null !== e && e !== '') { | |||
| for (const item of this.values) { | |||
| if (item.key === e) { | |||
| this.newValue = item; | |||
| break; | |||
| } | |||
| } | |||
| @@ -5,20 +5,6 @@ import {IGridSelectItem} from './grid-select-item'; | |||
| export class GridSelectFactory { | |||
| /** | |||
| * Returns select item for grid | |||
| * @param headerName | |||
| * @param field | |||
| * @param editable | |||
| * @param values | |||
| * @param itemKey | |||
| * @param itemValueKeys | |||
| * @param mandatory | |||
| * @param relatesOnDgField | |||
| * @param headerClass | |||
| * @param pinned | |||
| * @param cellClass | |||
| * @param exclusive | |||
| * @param exclusiveCompareData | |||
| * @param exclusiveCompareDataKey | |||
| */ | |||
| static getGridSelect(headerName: string, field: string, editable: boolean, values: any[], itemKey: string, | |||
| itemValueKeys: string[], mandatory: boolean = true, relatesOnDgField: string = null, | |||
| @@ -51,7 +37,7 @@ export class GridSelectFactory { | |||
| } | |||
| }; | |||
| if (mandatory) { | |||
| res.cellClassRules = { | |||
| res['cellClassRules'] = { | |||
| error(params) { | |||
| return params.value == null; | |||
| } | |||
| @@ -62,20 +48,6 @@ export class GridSelectFactory { | |||
| /** | |||
| * Returns select item for grid without renderer and editor | |||
| * @param headerName | |||
| * @param field | |||
| * @param editable | |||
| * @param values | |||
| * @param itemKey | |||
| * @param itemValueKeys | |||
| * @param mandatory | |||
| * @param relatesOnDgField | |||
| * @param headerClass | |||
| * @param pinned | |||
| * @param cellClass | |||
| * @param exclusive | |||
| * @param exclusiveCompareData | |||
| * @param exclusiveCompareDataKey | |||
| */ | |||
| static getGridSelectForSelectors(headerName: string, field: string, editable: boolean, values: any[], itemKey: string, | |||
| itemValueKeys: string[], mandatory: boolean = true, relatesOnDgField: string = null, | |||
| @@ -86,17 +58,13 @@ 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; | |||
| } | |||
| /** | |||
| * Returns array of grid select items | |||
| * @param objArray | |||
| * @param key | |||
| * @param valueKeys | |||
| * @param mandatory | |||
| */ | |||
| static getGridSelectItems(objArray: any[], key: string, valueKeys: string[], mandatory: boolean = true): IGridSelectItem[] { | |||
| const res: IGridSelectItem[] = []; | |||
| @@ -143,8 +111,6 @@ export class GridSelectFactory { | |||
| /** | |||
| * Returns displayed value of grid item | |||
| * @param obj | |||
| * @param valueKeys | |||
| */ | |||
| static getGridSelectItemValue(obj: any, valueKeys: string[]): string { | |||
| let value = ''; | |||
| @@ -22,7 +22,6 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| @@ -37,16 +36,15 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Case for static item range (all items in column have the same select items - default) | |||
| * @param params | |||
| */ | |||
| private setStaticValue(params: any): void { | |||
| if (this.itemRange === null || undefined === this.itemRange) { | |||
| // Item range is the same for all rows | |||
| this.itemRange = params.colDef.cellEditorParams.values as IGridSelectItem[]; | |||
| if (null !== params.value) { | |||
| for (let i = 0; i < this.itemRange.length; i++) { | |||
| if (this.itemRange[i].key === params.value) { | |||
| this.value = this.itemRange[i].value; | |||
| for (const item of this.itemRange) { | |||
| if (item.key === params.value) { | |||
| this.value = item.value; | |||
| break; | |||
| } | |||
| } | |||
| @@ -58,7 +56,6 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Case for item range related on other dg grid field (Select has always to be updated within init) | |||
| * @param params | |||
| */ | |||
| private setRelatedValue(params: any): void { | |||
| // @TODO: Might be checked | |||
| @@ -67,14 +64,14 @@ export class GridSelectRendererComponent extends GridRendererComponent { | |||
| const itemValueKeys: string[] = params.colDef.cellEditorParams.itemValueKeys; | |||
| // Get item range by related value | |||
| this.itemRange = params.data.hasOwnProperty(relatedValue) && null !== params.data[relatedValue]; ) ? | |||
| params.colDef.cellEditorParams.values[params.data[relatedValue]]; : null; | |||
| this.itemRange = params.data.hasOwnProperty(relatedValue) && null !== params.data[relatedValue] ? | |||
| params.colDef.cellEditorParams.values[params.data[relatedValue]] : null; | |||
| if (null !== params.value && null !== 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) { | |||
| this.value = GridSelectFactory.getGridSelectItemValue(this.itemRange[i], itemValueKeys); | |||
| for (const item of this.itemRange) { | |||
| if (item[itemKey] === params.value) { | |||
| this.value = GridSelectFactory.getGridSelectItemValue(item, itemValueKeys); | |||
| break; | |||
| } | |||
| } | |||
| @@ -10,7 +10,6 @@ import {GridEditorComponent} from '../../grid-editor-component'; | |||
| export class GridTextEditorComponent extends GridEditorComponent { | |||
| /** | |||
| * Cancels before value input (this editor is never editable) | |||
| * @returns {boolean} | |||
| */ | |||
| public isCancelBeforeStart(): boolean { | |||
| return true; | |||
| @@ -11,17 +11,16 @@ import {AgGridComponentConst} from '../../../components/ag-grid-component-const' | |||
| export class GridTextRendererComponent extends GridRendererComponent { | |||
| /** | |||
| * Initialize cell renderer (gets called on cell rendering and after editing / refresh) | |||
| * @param params | |||
| */ | |||
| agInit(params: any): void { | |||
| super.agInit(params); | |||
| if (undefined !== this.cellParams) { | |||
| // Replace "." with "," for display purpose | |||
| 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'); | |||
| 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) || null === this.value; ) ? ''; : 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? '' : this.value = parseInt(parseInt(this.value).toFixed(2)).toLocaleString('de-DE'); | |||
| } | |||
| } | |||
| } | |||
| @@ -11,7 +11,6 @@ export class RouteInterceptor { | |||
| /** | |||
| * Constructor of router service | |||
| * @param {Router} router | |||
| */ | |||
| constructor(private router: Router, private appService: AppService) { | |||
| // Observe login state | |||
| @@ -1,16 +1,11 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {ICustomerMeetingParticipant} from './customer-meeting-participant'; | |||
| import {MeetingInterface} from '../interface/meeting-interface'; | |||
| export interface ICustomerMeeting extends EntityInterface { | |||
| export interface ICustomerMeeting extends EntityInterface, MeetingInterface { | |||
| customer_id: number; | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| meeting_type_id: number; | |||
| is_option_meeting: boolean; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| customer_contact_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| @@ -24,11 +19,6 @@ export interface ICustomerMeeting extends EntityInterface { | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| v_participants: ICustomerMeetingParticipant[]; | |||
| v_is_editable: boolean; | |||
| } | |||
| @@ -1,18 +1,9 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IInternalMeetingParticipant} from './internal-meeting-participant'; | |||
| import {MeetingInterface} from '../interface/meeting-interface'; | |||
| export interface IInternalMeeting extends EntityInterface { | |||
| export interface IInternalMeeting extends EntityInterface, MeetingInterface { | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| v_participants: IInternalMeetingParticipant[]; | |||
| v_is_editable: boolean; | |||
| } | |||
| @@ -1,21 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IOperatorContact extends EntityInterface { | |||
| operator_id: string; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| date_of_birth: string; | |||
| comment: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| is_xmas_mail_recipient: boolean; | |||
| } | |||
| @@ -1,6 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IOperatorMeetingParticipant extends EntityInterface { | |||
| operator_meeting_id: number; | |||
| participant_user_id: number; | |||
| } | |||
| @@ -1,33 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IOperatorMeetingParticipant} from './operator-meeting-participant'; | |||
| export interface IOperatorMeeting extends EntityInterface { | |||
| operator_id: number; | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| meeting_type_id: number; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| operator_contact_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| department: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| v_participants: IOperatorMeetingParticipant[]; | |||
| v_is_editable: boolean; | |||
| } | |||
| @@ -1,22 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IOperatorNote extends EntityInterface { | |||
| operator_id: number; | |||
| operator_contact_id: number; | |||
| user_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| title: string; | |||
| comment: string; | |||
| note_date: string; | |||
| creation_date: string; | |||
| creation_user_id: number; | |||
| creation_user_firstname: string; | |||
| creation_user_lastname: string; | |||
| } | |||
| @@ -1,29 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IOperatorContact} from './operator-contact'; | |||
| import {IOperatorNote} from './operator-note'; | |||
| import {IOperatorMeeting} from './operator-meeting'; | |||
| export interface IOperator extends EntityInterface { | |||
| old_plp_id: string; | |||
| name: string; | |||
| name_additional: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| url: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| comment: string; | |||
| tax_no: string; | |||
| invoice_mode: string; | |||
| invoice_comment: string; | |||
| invoice_key: string; | |||
| active: boolean; | |||
| v_operator_contacts: IOperatorContact[]; | |||
| v_operator_notes: IOperatorNote[]; | |||
| v_operator_meetings: IOperatorMeeting[]; | |||
| } | |||
| @@ -1,21 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IProductionContact extends EntityInterface { | |||
| production_id: string; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| date_of_birth: string; | |||
| comment: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| is_xmas_mail_recipient: boolean; | |||
| } | |||
| @@ -1,6 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IProductionMeetingParticipant extends EntityInterface { | |||
| production_meeting_id: number; | |||
| participant_user_id: number; | |||
| } | |||
| @@ -1,33 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IProductionMeetingParticipant} from './production-meeting-participant'; | |||
| export interface IProductionMeeting extends EntityInterface { | |||
| production_id: number; | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| meeting_type_id: number; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| production_contact_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| department: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| v_participants: IProductionMeetingParticipant[]; | |||
| v_is_editable: boolean; | |||
| } | |||
| @@ -1,22 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IProductionNote extends EntityInterface { | |||
| production_id: number; | |||
| production_contact_id: number; | |||
| user_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| title: string; | |||
| comment: string; | |||
| note_date: string; | |||
| creation_date: string; | |||
| creation_user_id: number; | |||
| creation_user_firstname: string; | |||
| creation_user_lastname: string; | |||
| } | |||
| @@ -1,29 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IProductionContact} from './production-contact'; | |||
| import {IProductionNote} from './production-note'; | |||
| import {IProductionMeeting} from './production-meeting'; | |||
| export interface IProduction extends EntityInterface { | |||
| old_plp_id: string; | |||
| name: string; | |||
| name_additional: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| url: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| comment: string; | |||
| tax_no: string; | |||
| invoice_mode: string; | |||
| invoice_comment: string; | |||
| invoice_key: string; | |||
| active: boolean; | |||
| v_production_contacts: IProductionContact[]; | |||
| v_production_notes: IProductionNote[]; | |||
| v_production_meetings: IProductionMeeting[]; | |||
| } | |||
| @@ -1,21 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IServiceContact extends EntityInterface { | |||
| service_id: string; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| date_of_birth: string; | |||
| comment: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| is_xmas_mail_recipient: boolean; | |||
| } | |||
| @@ -1,6 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IServiceMeetingParticipant extends EntityInterface { | |||
| service_meeting_id: number; | |||
| participant_user_id: number; | |||
| } | |||
| @@ -1,33 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IServiceMeetingParticipant} from './service-meeting-participant'; | |||
| export interface IServiceMeeting extends EntityInterface { | |||
| service_id: number; | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| meeting_type_id: number; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| service_contact_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| department: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| v_participants: IServiceMeetingParticipant[]; | |||
| v_is_editable: boolean; | |||
| } | |||
| @@ -1,22 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| export interface IServiceNote extends EntityInterface { | |||
| service_id: number; | |||
| service_contact_id: number; | |||
| user_id: number; | |||
| gender: string; | |||
| firstname: string; | |||
| lastname: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| department: string; | |||
| title: string; | |||
| comment: string; | |||
| note_date: string; | |||
| creation_date: string; | |||
| creation_user_id: number; | |||
| creation_user_firstname: string; | |||
| creation_user_lastname: string; | |||
| } | |||
| @@ -1,29 +0,0 @@ | |||
| import {EntityInterface} from '../interface/entity-interface'; | |||
| import {IServiceContact} from './service-contact'; | |||
| import {IServiceNote} from './service-note'; | |||
| import {IServiceMeeting} from './service-meeting'; | |||
| export interface IService extends EntityInterface { | |||
| old_plp_id: string; | |||
| name: string; | |||
| name_additional: string; | |||
| street: string; | |||
| street_no: string; | |||
| zip: string; | |||
| city: string; | |||
| country_id: number; | |||
| url: string; | |||
| email: string; | |||
| phone_no: string; | |||
| mobile_no: string; | |||
| fax_no: string; | |||
| comment: string; | |||
| tax_no: string; | |||
| invoice_mode: string; | |||
| invoice_comment: string; | |||
| invoice_key: string; | |||
| active: boolean; | |||
| v_service_contacts: IServiceContact[]; | |||
| v_service_notes: IServiceNote[]; | |||
| v_service_meetings: IServiceMeeting[]; | |||
| } | |||
| @@ -0,0 +1,13 @@ | |||
| export interface MeetingInterface { | |||
| creation_user_id: number; | |||
| owner_user_id: number; | |||
| title: string; | |||
| description: string; | |||
| start_date: string; | |||
| end_date: string; | |||
| report: string; | |||
| first_reminder_sent: boolean; | |||
| second_reminder_sent: boolean; | |||
| report_reminder_sent: boolean; | |||
| creation_date: string; | |||
| } | |||
| @@ -1,13 +1,7 @@ | |||
| import {ICustomerMeeting} from '../entities/customer-meeting'; | |||
| import {IInternalMeeting} from '../entities/internal-meeting'; | |||
| import {IOperatorMeeting} from '../entities/operator-meeting'; | |||
| import {IProductionMeeting} from '../entities/production-meeting'; | |||
| import {IServiceMeeting} from '../entities/service-meeting'; | |||
| export interface IMeetingData { | |||
| customerMeetings: ICustomerMeeting[]; | |||
| internalMeetings: IInternalMeeting[]; | |||
| operatorMeetings: IOperatorMeeting[]; | |||
| productionMeetings: IProductionMeeting[]; | |||
| serviceMeetings: IServiceMeeting[]; | |||
| } | |||
| @@ -1,9 +0,0 @@ | |||
| import {IOperator} from '../entities/operator'; | |||
| import {IOperatorContact} from '../entities/operator-contact'; | |||
| import {IOperatorMeeting} from '../entities/operator-meeting'; | |||
| export interface IOperatorData { | |||
| operators: IOperator[]; | |||
| operatorContacts: IOperatorContact[]; | |||
| operatorMeetings: IOperatorMeeting[]; | |||
| } | |||
| @@ -1,9 +0,0 @@ | |||
| import {IProduction} from '../entities/production'; | |||
| import {IProductionContact} from '../entities/production-contact'; | |||
| import {IProductionMeeting} from '../entities/production-meeting'; | |||
| export interface IProductionData { | |||
| productions: IProduction[]; | |||
| productionContacts: IProductionContact[]; | |||
| productionMeetings: IProductionMeeting[]; | |||
| } | |||
| @@ -1,9 +0,0 @@ | |||
| import {IService} from '../entities/service'; | |||
| import {IServiceContact} from '../entities/service-contact'; | |||
| import {IServiceMeeting} from '../entities/service-meeting'; | |||
| export interface IServiceData { | |||
| services: IService[]; | |||
| serviceContacts: IServiceContact[]; | |||
| serviceMeetings: IServiceMeeting[]; | |||
| } | |||
| @@ -37,24 +37,23 @@ export class CustomerService { | |||
| /** | |||
| * Handles service data updates | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!null === serviceData) { } } {) { | |||
| const bSetNewData = false; | |||
| const updatedCustomers: ICustomer[] = this.customers.getValue(); | |||
| const updatedCustomerContacts: ICustomerContact[] = this.customerContacts.getValue(); | |||
| if (!null === serviceData.customers) { } } {) { | |||
| if (null !== serviceData) { | |||
| let bSetNewData = false; | |||
| let updatedCustomers: ICustomer[] = this.customers.getValue(); | |||
| let updatedCustomerContacts: ICustomerContact[] = this.customerContacts.getValue(); | |||
| if (null !== serviceData.customers) { | |||
| // Update service data | |||
| updatedCustomers = ServiceHelper.updateServiceEntries(serviceData.customers, this.customers.getValue()) as ICustomer[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!null === serviceData.customerContacts) { } } {) { | |||
| if (null !== serviceData.customerContacts) { | |||
| // Update service data | |||
| updatedCustomerContacts = ServiceHelper.updateServiceEntries(serviceData.customerContacts, this.customerContacts.getValue()) as ICustomerContact[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (bSetNewData) { | |||
| if (bSetNewData) { | |||
| this.setCustomerServiceData(updatedCustomers, updatedCustomerContacts); | |||
| } | |||
| } | |||
| @@ -62,10 +61,8 @@ export class CustomerService { | |||
| /** | |||
| * Sets customer service and cache data | |||
| * @param customers | |||
| * @param customerContacts | |||
| */ | |||
| private setCustomerServiceData(customers: ICustomer[], customerContacts: ICustomerContact[]); { | |||
| private setCustomerServiceData(customers: ICustomer[], customerContacts: ICustomerContact[]) { | |||
| this.customers.next(customers); | |||
| this.customerContacts.next(customerContacts); | |||
| } | |||
| @@ -73,34 +70,29 @@ export class CustomerService { | |||
| /** | |||
| * Reset service data (on logout) | |||
| */ | |||
| public resetCustomerServiceData(); { | |||
| public resetCustomerServiceData() { | |||
| this.customers.next(null); | |||
| this.customerContacts.next(null); | |||
| } | |||
| /** | |||
| * Returns observable of customers | |||
| * @returns {Observable<ICustomer[]>} | |||
| */ | |||
| public getCustomers$(); : Observable < ICustomer[] > { | |||
| public getCustomers$(): Observable <ICustomer[]> { | |||
| return this.dataCustomers$; | |||
| }; | |||
| /** | |||
| * Returns observable of customer contacts | |||
| * @returns {Observable<ICustomer[]>} | |||
| */ | |||
| public getCustomerContacts$(); : Observable < ICustomerContact[] > { | |||
| public getCustomerContacts$(): Observable <ICustomerContact[]> { | |||
| return this.dataCustomerContacts$; | |||
| }; | |||
| } | |||
| /** | |||
| * Gets all customers | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetCustomerData(); : void { | |||
| public apiGetCustomerData(): void { | |||
| this.httpService.apiGet('get-customer-data').subscribe( | |||
| data => { | |||
| const res: ICustomerData = data.result_data as ICustomerData; | |||
| @@ -108,114 +100,96 @@ export class CustomerService { | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Returns full customer | |||
| * @param {number} customerId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiGetCustomerFull(customerId: number); : Observable < IApiResponse > { | |||
| public apiGetCustomerFull(customerId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerId', JSON.stringify(customerId)); | |||
| return this.httpService.apiPost('get-customer-full', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Create customer | |||
| * @param {ICustomer} customer | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateCustomer(customer: ICustomer); : Observable < IApiResponse > { | |||
| public apiCreateCustomer(customer: ICustomer): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customer', JSON.stringify(customer)); | |||
| return this.httpService.apiPost('create-customer', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer | |||
| * @param {ICustomer} customer | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditCustomer(customer: ICustomer); : Observable < IApiResponse > { | |||
| public apiEditCustomer(customer: ICustomer): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customer', JSON.stringify(customer)); | |||
| return this.httpService.apiPost('edit-customer', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Create customer contact | |||
| * @param customerContact | |||
| */ | |||
| public apiCreateCustomerContact(customerContact: ICustomerContact); : Observable < IApiResponse > { | |||
| public apiCreateCustomerContact(customerContact: ICustomerContact): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerContact', JSON.stringify(customerContact)); | |||
| return this.httpService.apiPost('create-customer-contact', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer contact | |||
| * @param {ICustomerContact} customerContact | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditCustomerContact(customerContact: ICustomerContact); : Observable < IApiResponse > { | |||
| public apiEditCustomerContact(customerContact: ICustomerContact): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerContact', JSON.stringify(customerContact)); | |||
| return this.httpService.apiPost('edit-customer-contact', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Delete customer contact | |||
| * @param {number} customerContactId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteCustomerContact(customerContactId: number); : Observable < IApiResponse > { | |||
| public apiDeleteCustomerContact(customerContactId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerContactId', JSON.stringify(customerContactId)); | |||
| return this.httpService.apiPost('delete-customer-contact', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Create customer note | |||
| * @param {ICustomerNote} customerNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateCustomerNote(customerNote: ICustomerNote); : Observable < IApiResponse > { | |||
| public apiCreateCustomerNote(customerNote: ICustomerNote): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerNote', JSON.stringify(customerNote)); | |||
| return this.httpService.apiPost('create-customer-note', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer note | |||
| * @param {ICustomerNote} customerNote | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditCustomerNote(customerNote: ICustomerNote); : Observable < IApiResponse > { | |||
| public apiEditCustomerNote(customerNote: ICustomerNote): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerNote', JSON.stringify(customerNote)); | |||
| return this.httpService.apiPost('edit-customer-note', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Delete customer note | |||
| * @param {number} customerNoteId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteCustomerNote(customerNoteId: number); : Observable < IApiResponse > { | |||
| public apiDeleteCustomerNote(customerNoteId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerNoteId', JSON.stringify(customerNoteId)); | |||
| return this.httpService.apiPost('delete-customer-note', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer meeting report | |||
| * @param customerMeetingId | |||
| */ | |||
| public apiEditCustomerMeetingReport(customerMeetingId: number, customerMeetingReport: string); : Observable < IApiResponse > { | |||
| public apiEditCustomerMeetingReport(customerMeetingId: number, customerMeetingReport: string): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeetingId', JSON.stringify(customerMeetingId)); | |||
| formData.append('customerMeetingReport', JSON.stringify(customerMeetingReport)); | |||
| return this.httpService.apiPost('edit-customer-meeting-report', formData); | |||
| }; | |||
| } | |||
| } | |||
| @@ -3,7 +3,6 @@ import {HttpClient, HttpErrorResponse} from '@angular/common/http'; | |||
| import {BehaviorSubject, Observable} from 'rxjs'; | |||
| import {environment} from '../../environments/environment'; | |||
| import {finalize, tap} from 'rxjs/operators'; | |||
| import {isUndefined} from 'util'; | |||
| import {MessageService} from './message.service'; | |||
| import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {CacheService} from './cache.service'; | |||
| @@ -15,9 +14,6 @@ export class HttpService { | |||
| /** | |||
| * Constructor | |||
| * @param {HttpClient} httpClient | |||
| * @param {MessageService} messageService | |||
| * @param {RendererFactory2} rendererFactory | |||
| */ | |||
| constructor(private httpClient: HttpClient, private messageService: MessageService, private rendererFactory: RendererFactory2) { | |||
| this.renderer = this.rendererFactory.createRenderer(null, null); | |||
| @@ -34,7 +30,6 @@ export class HttpService { | |||
| /** | |||
| * Returns location observable | |||
| * @returns {Observable<ILocation[]>} | |||
| */ | |||
| public getServiceData$(): Observable<IAppServiceData> { | |||
| return this.dataServiceData$; | |||
| @@ -42,32 +37,29 @@ export class HttpService { | |||
| /** | |||
| * Processes optional cache service data delivered by call | |||
| * @param data | |||
| */ | |||
| private checkMessages(data: IApiResponse): void { | |||
| // Show optional success message | |||
| if (!isUndefined(data.success_code) && null !== data.success_code && data.success_code !== 0) { | |||
| if (undefined !== 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) && null !== data.info_code && data.info_code !== 0) { | |||
| if (undefined !== 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) && null !== data.error_code && data.error_code !== 0) { | |||
| if (undefined !== data.error_code && null !== data.error_code && data.error_code !== 0) { | |||
| this.messageService.setError(data.error_code, data.error_msg); | |||
| } | |||
| } | |||
| /** | |||
| * Handles http error repsonse | |||
| * @param {HttpErrorResponse} error | |||
| * @param {boolean} serviceDataCheck | |||
| */ | |||
| private handleError(error: HttpErrorResponse, serviceDataCheck: boolean): void { | |||
| if (error.status == HttpService.AUTHENTICATION_ERROR_CODE) { | |||
| if (error.status === HttpService.AUTHENTICATION_ERROR_CODE) { | |||
| this.messageService.setError(HttpService.AUTHENTICATION_ERROR_CODE, HttpService.AUTHENTICATION_ERROR_MESSAGE); | |||
| } else { | |||
| const response: IApiResponse = error.error as IApiResponse; | |||
| @@ -80,7 +72,6 @@ export class HttpService { | |||
| /** | |||
| * Toggles loader icon | |||
| * @param show | |||
| */ | |||
| public showLoader(show: boolean): void { | |||
| show ? | |||
| @@ -89,12 +80,7 @@ export class HttpService { | |||
| } | |||
| /** | |||
| * | |||
| * @param {string} urlResource | |||
| * @param {number} id | |||
| * @param {boolean} serviceDataCheck | |||
| * @param {boolean} loaderIcon | |||
| * @returns {Observable<IApiResponse>} | |||
| * Api get call | |||
| */ | |||
| public apiGet(urlResource: string, id: number = null, serviceDataCheck: boolean = true, loaderIcon: boolean = true): Observable<IApiResponse> { | |||
| this.showLoader(true); | |||
| @@ -122,11 +108,6 @@ export class HttpService { | |||
| /** | |||
| * Post api call | |||
| * @param {string} urlResource | |||
| * @param {FormData} formData | |||
| * @param {boolean} serviceDataCheck | |||
| * @param {boolean} withLoaderIcon | |||
| * @returns {Observable<any>} | |||
| */ | |||
| public apiPost(urlResource: string, formData: FormData, serviceDataCheck: boolean = true, withLoaderIcon: boolean = true): Observable<any> { | |||
| if (withLoaderIcon) { | |||
| @@ -159,9 +140,6 @@ export class HttpService { | |||
| /** | |||
| * Post call for excel files | |||
| * @param {string} urlResource | |||
| * @param {FormData} formData | |||
| * @returns {Observable<any>} | |||
| */ | |||
| public apiFilePost(urlResource: string, formData: FormData): Observable<any> { | |||
| this.showLoader(true); | |||
| @@ -7,13 +7,9 @@ import {IApiResponse} from '../model/virtual/api-response'; | |||
| import {IAppServiceData} from '../model/virtual/app-service-data'; | |||
| import {saveAs} from 'file-saver'; | |||
| import {ServiceHelper} from '../utils/service-helper'; | |||
| import {ICustomerNote} from '../model/entities/customer-note'; | |||
| import {ICustomerMeeting} from '../model/entities/customer-meeting'; | |||
| import {IInternalMeeting} from '../model/entities/internal-meeting'; | |||
| import {IMeetingData} from '../model/virtual/meeting-data'; | |||
| import {IOperatorMeeting} from '../model/entities/operator-meeting'; | |||
| import {IProductionMeeting} from '../model/entities/production-meeting'; | |||
| import {IServiceMeeting} from '../model/entities/service-meeting'; | |||
| @Injectable() | |||
| export class MeetingService { | |||
| @@ -22,12 +18,6 @@ export class MeetingService { | |||
| private customerMeetings$: Observable<ICustomerMeeting[]>; | |||
| private internalMeetings: BehaviorSubject<IInternalMeeting[]>; | |||
| private internalMeetings$: Observable<IInternalMeeting[]>; | |||
| private operatorMeetings: BehaviorSubject<IOperatorMeeting[]>; | |||
| private operatorMeetings$: Observable<IOperatorMeeting[]>; | |||
| private productionMeetings: BehaviorSubject<IProductionMeeting[]>; | |||
| private productionMeetings$: Observable<IProductionMeeting[]>; | |||
| private serviceMeetings: BehaviorSubject<IServiceMeeting[]>; | |||
| private serviceMeetings$: Observable<IServiceMeeting[]>; | |||
| private meetingData: BehaviorSubject<IMeetingData>; | |||
| private meetingData$: Observable<IMeetingData>; | |||
| private serviceDataSub: Subscription; | |||
| @@ -37,12 +27,6 @@ export class MeetingService { | |||
| this.customerMeetings$ = this.customerMeetings.asObservable(); | |||
| this.internalMeetings = new BehaviorSubject<IInternalMeeting[]>(null); | |||
| this.internalMeetings$ = this.internalMeetings.asObservable(); | |||
| this.operatorMeetings = new BehaviorSubject<IOperatorMeeting[]>(null); | |||
| this.operatorMeetings$ = this.operatorMeetings.asObservable(); | |||
| this.productionMeetings = new BehaviorSubject<IProductionMeeting[]>(null); | |||
| this.productionMeetings$ = this.productionMeetings.asObservable(); | |||
| this.serviceMeetings = new BehaviorSubject<IServiceMeeting[]>(null); | |||
| this.serviceMeetings$ = this.serviceMeetings.asObservable(); | |||
| this.meetingData = new BehaviorSubject<IMeetingData>(null); | |||
| this.meetingData$ = this.meetingData.asObservable(); | |||
| @@ -58,48 +42,27 @@ export class MeetingService { | |||
| /** | |||
| * Handles service data updates | |||
| * @param {IAppServiceData} serviceData | |||
| */ | |||
| public handleServiceData(serviceData: IAppServiceData = null): void { | |||
| if (!null === serviceData) { } } {) { | |||
| const bSetNewData = false; | |||
| const updatedCustomerMeetings: ICustomerMeeting[] = this.customerMeetings.getValue(); | |||
| const updatedInternalMeetings: IInternalMeeting[] = this.internalMeetings.getValue(); | |||
| const updatedOperatorMeetings: IOperatorMeeting[] = this.operatorMeetings.getValue(); | |||
| const updatedProductionMeetings: IProductionMeeting[] = this.productionMeetings.getValue(); | |||
| const updatedServiceMeetings: IServiceMeeting[] = this.serviceMeetings.getValue(); | |||
| if (!null === serviceData.customerMeetings) { } } {) { | |||
| if (null !== serviceData) { | |||
| let bSetNewData = false; | |||
| let updatedCustomerMeetings: ICustomerMeeting[] = this.customerMeetings.getValue(); | |||
| let updatedInternalMeetings: IInternalMeeting[] = this.internalMeetings.getValue(); | |||
| if (null !== serviceData.customerMeetings) { | |||
| // Update service data | |||
| updatedCustomerMeetings = ServiceHelper.updateServiceEntries(serviceData.customerMeetings, this.customerMeetings.getValue()) as ICustomerMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!null === serviceData.internalMeetings) { } } {) { | |||
| if (null !== serviceData.internalMeetings) { | |||
| // Update service data | |||
| updatedInternalMeetings = ServiceHelper.updateServiceEntries(serviceData.internalMeetings, this.internalMeetings.getValue()) as IInternalMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!null === serviceData.operatorMeetings) { } } {) { | |||
| // Update service data | |||
| updatedOperatorMeetings = ServiceHelper.updateServiceEntries(serviceData.operatorMeetings, this.operatorMeetings.getValue()) as IOperatorMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!null === serviceData.productionMeetings) { } } {) { | |||
| // Update service data | |||
| updatedProductionMeetings = ServiceHelper.updateServiceEntries(serviceData.productionMeetings, this.productionMeetings.getValue()) as IProductionMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (!null === serviceData.operatorMeetings) { } } {) { | |||
| // Update service data | |||
| updatedServiceMeetings = ServiceHelper.updateServiceEntries(serviceData.serviceMeetings, this.serviceMeetings.getValue()) as IServiceMeeting[]; | |||
| bSetNewData = true; | |||
| } | |||
| if (bSetNewData) { | |||
| if (bSetNewData) { | |||
| const meetingData: {} = { | |||
| customerMeetings: updatedCustomerMeetings, | |||
| internalMeetings: updatedInternalMeetings, | |||
| operatorMeetings: updatedOperatorMeetings, | |||
| productionMeetings: updatedProductionMeetings, | |||
| serviceMeetings: updatedServiceMeetings, | |||
| }; | |||
| this.setMeetingServiceData(meetingData as IMeetingData); | |||
| } | |||
| @@ -108,58 +71,38 @@ export class MeetingService { | |||
| /** | |||
| * Sets customer service and cache data | |||
| * @param meetingData | |||
| */ | |||
| private setMeetingServiceData(meetingData: IMeetingData); { | |||
| private setMeetingServiceData(meetingData: IMeetingData) { | |||
| this.meetingData.next(meetingData); | |||
| this.customerMeetings.next(meetingData.customerMeetings); | |||
| this.internalMeetings.next(meetingData.internalMeetings); | |||
| this.operatorMeetings.next(meetingData.operatorMeetings); | |||
| this.productionMeetings.next(meetingData.productionMeetings); | |||
| this.serviceMeetings.next(meetingData.serviceMeetings); | |||
| } | |||
| /** | |||
| * Reset service data (on logout) | |||
| */ | |||
| public resetMeetingServiceData(); { | |||
| public resetMeetingServiceData() { | |||
| this.meetingData.next(null); | |||
| this.customerMeetings.next(null); | |||
| this.internalMeetings.next(null); | |||
| this.operatorMeetings.next(null); | |||
| this.productionMeetings.next(null); | |||
| this.serviceMeetings.next(null); | |||
| } | |||
| public getMeetingsData$(); : Observable < IMeetingData > { | |||
| public getMeetingsData$(): Observable <IMeetingData> { | |||
| return this.meetingData$; | |||
| }; | |||
| } | |||
| public getCustomerMeetings$(); : Observable < ICustomerMeeting[] > { | |||
| public getCustomerMeetings$(): Observable <ICustomerMeeting[]> { | |||
| return this.customerMeetings$; | |||
| }; | |||
| } | |||
| public getInternalMeetings$(); : Observable < IInternalMeeting[] > { | |||
| public getInternalMeetings$(): Observable <IInternalMeeting[]> { | |||
| return this.internalMeetings$; | |||
| }; | |||
| public getOperatorMeetings$(); : Observable < IOperatorMeeting[] > { | |||
| return this.operatorMeetings$; | |||
| }; | |||
| public getProductionMeetings$(); : Observable < IProductionMeeting[] > { | |||
| return this.productionMeetings$; | |||
| }; | |||
| public getServiceMeetings$(); : Observable < IServiceMeeting[] > { | |||
| return this.serviceMeetings$; | |||
| }; | |||
| } | |||
| /** | |||
| * Gets all customers | |||
| * @returns {Observable<IApiResponse>} | |||
| * Gets meeting data | |||
| */ | |||
| public apiGetMeetingData(); : void { | |||
| public apiGetMeetingData(): void { | |||
| this.httpService.apiGet('get-meeting-data').subscribe( | |||
| data => { | |||
| const res: IMeetingData = data.result_data as IMeetingData; | |||
| @@ -167,280 +110,104 @@ export class MeetingService { | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Create customer meeting | |||
| * @param {ICustomerNote} customerMeeting | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiCreateCustomerMeeting(customerMeeting: ICustomerMeeting); : Observable < IApiResponse > { | |||
| public apiCreateCustomerMeeting(customerMeeting: ICustomerMeeting): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeeting', JSON.stringify(customerMeeting)); | |||
| return this.httpService.apiPost('create-customer-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer meeting | |||
| * @param {ICustomerNote} customerMeeting | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiEditCustomerMeeting(customerMeeting: ICustomerMeeting); : Observable < IApiResponse > { | |||
| public apiEditCustomerMeeting(customerMeeting: ICustomerMeeting): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeeting', JSON.stringify(customerMeeting)); | |||
| return this.httpService.apiPost('edit-customer-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Delete customer meeting | |||
| * @param {number} customerMeetingId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteCustomerMeeting(customerMeetingId: number); : Observable < IApiResponse > { | |||
| public apiDeleteCustomerMeeting(customerMeetingId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeetingId', JSON.stringify(customerMeetingId)); | |||
| return this.httpService.apiPost('delete-customer-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Checks customer meeting report | |||
| * @param customerMeetingId | |||
| */ | |||
| public apiCheckCustomerMeetingReport(customerMeetingId: number); : Observable < IApiResponse > { | |||
| public apiCheckCustomerMeetingReport(customerMeetingId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeetingId', JSON.stringify(customerMeetingId)); | |||
| return this.httpService.apiPost('check-customer-meeting-report', formData, true); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer meeting report | |||
| * @param customerMeetingId | |||
| * @param customerMeetingReport | |||
| */ | |||
| public apiEditCustomerMeetingReport(customerMeetingId: number, customerMeetingReport: string); : Observable < IApiResponse > { | |||
| public apiEditCustomerMeetingReport(customerMeetingId: number, customerMeetingReport: string): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('customerMeetingId', JSON.stringify(customerMeetingId)); | |||
| formData.append('customerMeetingReport', JSON.stringify(customerMeetingReport)); | |||
| return this.httpService.apiPost('edit-customer-meeting-report', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Create internal meeting | |||
| * @param internalMeeting | |||
| */ | |||
| public apiCreateInternalMeeting(internalMeeting: IInternalMeeting); : Observable < IApiResponse > { | |||
| public apiCreateInternalMeeting(internalMeeting: IInternalMeeting): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('internalMeeting', JSON.stringify(internalMeeting)); | |||
| return this.httpService.apiPost('create-internal-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit internal meeting | |||
| * @param internalMeeting | |||
| */ | |||
| public apiEditInternalMeeting(internalMeeting: IInternalMeeting); : Observable < IApiResponse > { | |||
| public apiEditInternalMeeting(internalMeeting: IInternalMeeting): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('internalMeeting', JSON.stringify(internalMeeting)); | |||
| return this.httpService.apiPost('edit-internal-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Delete internal meeting | |||
| * @param internalMeetingId | |||
| */ | |||
| public apiDeleteInternalMeeting(internalMeetingId: number); : Observable < IApiResponse > { | |||
| public apiDeleteInternalMeeting(internalMeetingId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('internalMeetingId', JSON.stringify(internalMeetingId)); | |||
| return this.httpService.apiPost('delete-internal-meeting', formData); | |||
| }; | |||
| } | |||
| /** | |||
| * Checks internal meeting report | |||
| * @param internalMeetingId | |||
| */ | |||
| public apiCheckInternalMeetingReport(internalMeetingId: number); : Observable < IApiResponse > { | |||
| public apiCheckInternalMeetingReport(internalMeetingId: number): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('internalMeetingId', JSON.stringify(internalMeetingId)); | |||
| return this.httpService.apiPost('check-internal-meeting-report', formData, false); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit internal meeting report | |||
| * @param internalMeetingId | |||
| * @param internalMeetingReport | |||
| */ | |||
| public apiEditInternalMeetingReport(internalMeetingId: number, internalMeetingReport: string); : Observable < IApiResponse > { | |||
| public apiEditInternalMeetingReport(internalMeetingId: number, internalMeetingReport: string): Observable <IApiResponse> { | |||
| const formData = new FormData(); | |||
| formData.append('internalMeetingId', JSON.stringify(internalMeetingId)); | |||
| formData.append('internalMeetingReport', JSON.stringify(internalMeetingReport)); | |||
| return this.httpService.apiPost('edit-internal-meeting-report', formData); | |||
| }; | |||
| /** | |||
| * Create operator meeting | |||
| * @param operatorMeeting | |||
| */ | |||
| public apiCreateOperatorMeeting(operatorMeeting: IOperatorMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('operatorMeeting', JSON.stringify(operatorMeeting)); | |||
| return this.httpService.apiPost('create-operator-meeting', formData); | |||
| }; | |||
| /** | |||
| * Edit operator meeting | |||
| * @param operatorMeeting | |||
| */ | |||
| public apiEditOperatorMeeting(operatorMeeting: IOperatorMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('operatorMeeting', JSON.stringify(operatorMeeting)); | |||
| return this.httpService.apiPost('edit-operator-meeting', formData); | |||
| }; | |||
| /** | |||
| * Delete operator meeting | |||
| * @param {number} operatorMeetingId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteOperatorMeeting(operatorMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('operatorMeetingId', JSON.stringify(operatorMeetingId)); | |||
| return this.httpService.apiPost('delete-operator-meeting', formData); | |||
| }; | |||
| /** | |||
| * Checks operator meeting report | |||
| * @param operatorMeetingId | |||
| */ | |||
| public apiCheckOperatorMeetingReport(operatorMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('operatorMeetingId', JSON.stringify(operatorMeetingId)); | |||
| return this.httpService.apiPost('check-operator-meeting-report', formData, true); | |||
| }; | |||
| /** | |||
| * 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); | |||
| }; | |||
| /** | |||
| * Create production meeting | |||
| * @param productionMeeting | |||
| */ | |||
| public apiCreateProductionMeeting(productionMeeting: IProductionMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('productionMeeting', JSON.stringify(productionMeeting)); | |||
| return this.httpService.apiPost('create-production-meeting', formData); | |||
| }; | |||
| /** | |||
| * Edit production meeting | |||
| * @param productionMeeting | |||
| */ | |||
| public apiEditProductionMeeting(productionMeeting: IProductionMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('productionMeeting', JSON.stringify(productionMeeting)); | |||
| return this.httpService.apiPost('edit-production-meeting', formData); | |||
| }; | |||
| /** | |||
| * Delete production meeting | |||
| * @param {number} productionMeetingId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteProductionMeeting(productionMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('productionMeetingId', JSON.stringify(productionMeetingId)); | |||
| return this.httpService.apiPost('delete-production-meeting', formData); | |||
| }; | |||
| /** | |||
| * Checks production meeting report | |||
| * @param productionMeetingId | |||
| */ | |||
| public apiCheckProductionMeetingReport(productionMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('productionMeetingId', JSON.stringify(productionMeetingId)); | |||
| return this.httpService.apiPost('check-production-meeting-report', formData, true); | |||
| }; | |||
| /** | |||
| * 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); | |||
| }; | |||
| /** | |||
| * Create service meeting | |||
| * @param serviceMeeting | |||
| */ | |||
| public apiCreateServiceMeeting(serviceMeeting: IServiceMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('serviceMeeting', JSON.stringify(serviceMeeting)); | |||
| return this.httpService.apiPost('create-service-meeting', formData); | |||
| }; | |||
| /** | |||
| * Edit service meeting | |||
| * @param serviceMeeting | |||
| */ | |||
| public apiEditServiceMeeting(serviceMeeting: IServiceMeeting); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('serviceMeeting', JSON.stringify(serviceMeeting)); | |||
| return this.httpService.apiPost('edit-service-meeting', formData); | |||
| }; | |||
| /** | |||
| * Delete service meeting | |||
| * @param {number} serviceMeetingId | |||
| * @returns {Observable<IApiResponse>} | |||
| */ | |||
| public apiDeleteServiceMeeting(serviceMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('serviceMeetingId', JSON.stringify(serviceMeetingId)); | |||
| return this.httpService.apiPost('delete-service-meeting', formData); | |||
| }; | |||
| /** | |||
| * Checks production meeting report | |||
| * @param serviceMeetingId | |||
| */ | |||
| public apiCheckServiceMeetingReport(serviceMeetingId: number); : Observable < IApiResponse > { | |||
| const formData = new FormData(); | |||
| formData.append('serviceMeetingId', JSON.stringify(serviceMeetingId)); | |||
| return this.httpService.apiPost('check-service-meeting-report', formData, true); | |||
| }; | |||
| /** | |||
| * 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 apiExportMeetingList(meetingList: {}[], fileName: string); : void { | |||
| public apiExportMeetingList(meetingList: {}[], fileName: string): void { | |||
| const formData = new FormData(); | |||
| formData.append('meetingList', JSON.stringify(meetingList)); | |||
| this.httpService.apiFilePost('export-meeting-list', formData).subscribe( | |||
| @@ -450,5 +217,5 @@ export class MeetingService { | |||
| error => { | |||
| } | |||
| ); | |||
| }; | |||
| } | |||
| } | |||
| @@ -15,15 +15,14 @@ | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [rowSelection]="rowSelection" | |||
| [rowDeselection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerContactPersonDetailList> | |||
| <app-spt-modal [overlay]="true" #modalCustomerContactPersonDetailList> | |||
| <app-customer-contact-person-detail #customerContactPersonDetailList (editCustomerContact)="editCustomerContactFunction($event)" | |||
| (deleteCustomerContact)="deleteCustomerContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-customer-contact-person-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -1,4 +1,4 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {Component, EventEmitter, NgModule, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {AgGridComponent} from '../../../components/ag-grid-component'; | |||
| import {ICustomer} from '../../../model/entities/customer'; | |||
| import {ICustomerContact} from '../../../model/entities/customer-contact'; | |||
| @@ -9,6 +9,7 @@ import {CustomerService} from '../../../services/customer.service'; | |||
| import {Const} from '../../../utils/const'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {CommonService} from '../../../services/common.service'; | |||
| import {AgGridAngular} from 'ag-grid-angular'; | |||
| @Component({ | |||
| selector: 'app-customer-contact-list', | |||
| @@ -79,7 +80,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| */ | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| if (null !== this.customerContacts) { } } {) { | |||
| if (null !== this.customerContacts){ | |||
| for (let i = 0; i < this.customerContacts.length; i++) { | |||
| this.rowData.push({ | |||
| id: this.customerContacts[i].id, | |||
| @@ -102,7 +103,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| * Row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any); { | |||
| public rowClicked(e: any): void { | |||
| this.modalCustomerContactPersonDetailList.openModal(); | |||
| this.customerContactPersonDetailList.setData(this.customersById[e.data.customer_id], Utils.deepClone(this.customerContactsById[e.data.id]) as ICustomerContact); | |||
| } | |||
| @@ -111,7 +112,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| * Edit customer contact | |||
| * @param customerContact | |||
| */ | |||
| public editCustomerContactFunction(customerContact: ICustomerContact); : void { | |||
| public editCustomerContactFunction(customerContact: ICustomerContact): void { | |||
| this.customerService.apiEditCustomerContact(customerContact).subscribe( | |||
| data => { | |||
| this.customerContactPersonDetailList.updateData(data.result_data as ICustomer); | |||
| @@ -124,7 +125,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| * Delete customer contact | |||
| * @param contactId | |||
| */ | |||
| public deleteCustomerContactFunction(contactId: number); : void { | |||
| public deleteCustomerContactFunction(contactId: number): void { | |||
| this.customerService.apiDeleteCustomerContact(contactId).subscribe( | |||
| data => { | |||
| this.modalCustomerContactPersonDetailList.closeModal(); | |||
| @@ -137,7 +138,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| * Shortcut to customer detail | |||
| * @param customer | |||
| */ | |||
| public shortcutFunction(customer: ICustomer); : void { | |||
| public shortcutFunction(customer: ICustomer): void { | |||
| this.modalCustomerContactPersonDetailList.closeModal(); | |||
| this.shortcut.emit(customer); | |||
| }; | |||
| @@ -145,14 +146,14 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Export customer contacts pdf | |||
| */ | |||
| public exportCustomerContactsPdf(); : void { | |||
| public exportCustomerContactsPdf(): void { | |||
| this.commonService.apiExportContactsPdf('Kunden_Kontakte', 'customer'); | |||
| }; | |||
| /** | |||
| * Export customer xmas pdf | |||
| */ | |||
| public exportXmasPdf(); : void { | |||
| public exportXmasPdf(): void { | |||
| this.commonService.apiExportXmasPdf('Kunden_Weihnachten', 'customer'); | |||
| }; | |||
| } | |||
| @@ -15,7 +15,6 @@ | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [rowSelection]="rowSelection" | |||
| [rowDeselection]="true" | |||
| [rowClassRules]="rowClassRules" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| @@ -11,7 +11,7 @@ | |||
| </app-tabs> | |||
| </div> | |||
| <app-modal #modalCM> | |||
| <app-spt-modal #modalCM> | |||
| <app-customer-view #customerView | |||
| (editCustomer)="editCustomerFunction($event)" | |||
| (createCustomerContact)="createCustomerContactFunction($event)" | |||
| @@ -25,9 +25,9 @@ | |||
| (deleteMeeting)="deleteCustomerMeetingFunction($event)" | |||
| (editMeetingReport)="editCustomerMeetingReportFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-customer-view> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalCustomerDataEdit> | |||
| </app-spt-modal> | |||
| <app-spt-modal [overlay]="true" #modalCustomerDataEdit> | |||
| <div id="customer-data-modal"> | |||
| <app-customer-data-edit #customerDataEdit (createCustomer)="createCustomerFunction($event)"></app-customer-data-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -67,7 +67,7 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| * Set component data after all data has been received | |||
| */ | |||
| private setComponentData() { | |||
| if (null !== this.customers && null !== this.customerContacts) { } } {) { | |||
| if (null !== this.customers && null !== this.customerContacts){ | |||
| this.customerList.setData(this.customers); | |||
| this.customerContactList.setData(this.customers, this.customerContacts); | |||
| } | |||
| @@ -75,9 +75,8 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| /** | |||
| * Customer row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClickedCustomer(e: any); { | |||
| public rowClickedCustomer(e: any): void { | |||
| this.customerService.apiGetCustomerFull(e.data.customer_id).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| @@ -90,146 +89,135 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| /** | |||
| * OnClick Create customer | |||
| */ | |||
| public createCustomer(); : void { | |||
| public createCustomer(): void { | |||
| this.modalCustomerDataEdit.openModal(); | |||
| this.customerDataEdit.setData(Factory.getEmptyCustomer()); | |||
| }; | |||
| } | |||
| /** | |||
| * Creates customer | |||
| * @param customer | |||
| */ | |||
| public createCustomerFunction(customer: ICustomer); : void { | |||
| public createCustomerFunction(customer: ICustomer): void { | |||
| this.customerService.apiCreateCustomer(customer).subscribe( | |||
| data => { | |||
| this.modalCustomerDataEdit.closeModal(); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Saves customer | |||
| * @param customer | |||
| */ | |||
| public editCustomerFunction(customer: ICustomer); : void { | |||
| public editCustomerFunction(customer: ICustomer): void { | |||
| this.customerService.apiEditCustomer(customer).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Creates customer contact | |||
| * @param customerContact | |||
| */ | |||
| public createCustomerContactFunction(customerContact: ICustomerContact); : void { | |||
| public createCustomerContactFunction(customerContact: ICustomerContact): void { | |||
| this.customerService.apiCreateCustomerContact(customerContact).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Edit customer contact | |||
| * @param customerContact | |||
| */ | |||
| public editCustomerContactFunction(customerContact: ICustomerContact); : void { | |||
| public editCustomerContactFunction(customerContact: ICustomerContact): void { | |||
| this.customerService.apiEditCustomerContact(customerContact).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Deletes customer contact | |||
| * @param contactId | |||
| */ | |||
| public deleteCustomerContactFunction(contactId: number); : void { | |||
| public deleteCustomerContactFunction(contactId: number): void { | |||
| this.customerService.apiDeleteCustomerContact(contactId).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Creates customer note entry | |||
| * @param customerNote | |||
| */ | |||
| public createCustomerNoteFunction(customerNote: ICustomerNote); : void { | |||
| public createCustomerNoteFunction(customerNote: ICustomerNote): void { | |||
| this.customerService.apiCreateCustomerNote(customerNote).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Edits customer note entry | |||
| * @param customerNote | |||
| */ | |||
| public editCustomerNoteFunction(customerNote: ICustomerNote); : void { | |||
| public editCustomerNoteFunction(customerNote: ICustomerNote): void { | |||
| this.customerService.apiEditCustomerNote(customerNote).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Deletes customer note entry | |||
| * @param customerNoteId | |||
| */ | |||
| public deleteCustomerNoteFunction(customerNoteId: number); : void { | |||
| public deleteCustomerNoteFunction(customerNoteId: number): void { | |||
| this.customerService.apiDeleteCustomerNote(customerNoteId).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Creates customer meeting entry | |||
| * @param customerMeeting | |||
| */ | |||
| public createCustomerMeetingFunction(customerMeeting: ICustomerMeeting); : void { | |||
| public createCustomerMeetingFunction(customerMeeting: ICustomerMeeting): void { | |||
| this.meetingService.apiCreateCustomerMeeting(customerMeeting).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Edits customer meeting entry | |||
| * @param customerMeeting | |||
| */ | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting); : void { | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting): void { | |||
| this.meetingService.apiEditCustomerMeeting(customerMeeting).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer, true); | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Deletes customer meeting entry | |||
| * @param customerMeetingId | |||
| */ | |||
| public deleteCustomerMeetingFunction(customerMeetingId: number); : void { | |||
| public deleteCustomerMeetingFunction(customerMeetingId: number): void { | |||
| this.meetingService.apiDeleteCustomerMeeting(customerMeetingId).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| @@ -240,9 +228,8 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| /** | |||
| * Edit report after meeting has started | |||
| * @param reportValues | |||
| */ | |||
| public editCustomerMeetingReportFunction(reportValues: any); : void { | |||
| public editCustomerMeetingReportFunction(reportValues: any): void { | |||
| const meetingId: number = reportValues.id; | |||
| const report: string = reportValues.report; | |||
| this.meetingService.apiEditCustomerMeetingReport(meetingId, report).subscribe( | |||
| @@ -251,13 +238,12 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Shortcut to customer detail | |||
| * @param customer | |||
| */ | |||
| public shortcutFunction(customer: ICustomer); : void { | |||
| public shortcutFunction(customer: ICustomer) : void { | |||
| this.customerService.apiGetCustomerFull(customer.id).subscribe( | |||
| data => { | |||
| this.customerView.setData(data.result_data as ICustomer); | |||
| @@ -265,13 +251,13 @@ export class CustomerManagementComponent extends AgGridComponent implements OnIn | |||
| }, | |||
| error => {} | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Destroy | |||
| */ | |||
| ngOnDestroy(); : void { | |||
| if(this.customersSub !== null && this.customersSub !== undefined); { | |||
| ngOnDestroy(): void { | |||
| if(this.customersSub !== null && this.customersSub !== undefined) { | |||
| this.customersSub.unsubscribe(); | |||
| } | |||
| } | |||
| @@ -2,7 +2,7 @@ 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 {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| @@ -23,8 +23,8 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| public customerContact: ICustomerContact; | |||
| public config: IConfig; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| constructor(private appService: AppService, /*protected scrollToService: ScrollToService*/) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -34,7 +34,6 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| /** | |||
| * Sets data | |||
| * @param customerContact | |||
| */ | |||
| public setData(customerContact: ICustomerContact): void { | |||
| this.customerContact = customerContact; | |||
| @@ -52,15 +51,13 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| /** | |||
| * Saves customer | |||
| * @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 (null === this.customerContact.date_of_birth || | |||
| !(null === this.customerContact.date_of_birth && Utils.isValidDate(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 { | |||
| @@ -69,10 +66,10 @@ export class CustomerContactPersonEditComponent extends FormComponent implements | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(this.isCreationMode ? 'customer-contact-person-modal' : 'customer-contact-person-edit-modal'); | |||
| // todo this.scrollUp(this.isCreationMode ? 'customer-contact-person-modal' : 'customer-contact-person-edit-modal'); | |||
| } | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'customer-contact-person-modal' : 'customer-contact-person-edit-modal'); | |||
| // todo this.scrollUp(this.isCreationMode ? 'customer-contact-person-modal' : 'customer-contact-person-edit-modal'); | |||
| } | |||
| } | |||
| @@ -21,15 +21,15 @@ | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerContactPersonDetail> | |||
| <app-spt-modal [overlay]="true" #modalCustomerContactPersonDetail> | |||
| <app-customer-contact-person-detail #customerContactPersonDetail (editCustomerContact)="editCustomerContactFunction($event)" | |||
| (deleteCustomerContact)="deleteCustomerContactFunction($event)" | |||
| (shortcut)="shortcutFunction($event)"></app-customer-contact-person-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| <app-modal [overlay]="true" #modalCustomerContactPersonEdit> | |||
| <app-spt-modal [overlay]="true" #modalCustomerContactPersonEdit> | |||
| <div id="customer-contact-person-modal"> | |||
| <app-customer-contact-person-edit #customerContactPersonEdit | |||
| (createCustomerContact)="createCustomerContactFunction($event)"></app-customer-contact-person-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -2,7 +2,7 @@ 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 {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {AppService} from '../../../../services/app.service'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| @@ -26,8 +26,8 @@ export class CustomerDataEditComponent extends FormComponent implements OnInit { | |||
| public usersById: {}; | |||
| public consultant: IUser; | |||
| constructor(private appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| constructor(private appService: AppService, /*protected scrollToService: ScrollToService*/) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -40,7 +40,6 @@ export class CustomerDataEditComponent extends FormComponent implements OnInit { | |||
| /** | |||
| * Sets data | |||
| * @param customer | |||
| */ | |||
| public setData(customer: ICustomer): void { | |||
| this.customer = customer; | |||
| @@ -58,8 +57,6 @@ export class CustomerDataEditComponent extends FormComponent implements OnInit { | |||
| /** | |||
| * Saves customer | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| @@ -71,7 +68,7 @@ export class CustomerDataEditComponent extends FormComponent implements OnInit { | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'customer-data-modal' : 'customer-data-edit-modal'); | |||
| // todo this.scrollUp(this.isCreationMode ? 'customer-data-modal' : 'customer-data-edit-modal'); | |||
| } | |||
| } | |||
| @@ -33,8 +33,8 @@ | |||
| </div> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerDataEdit> | |||
| <app-spt-modal [overlay]="true" #modalCustomerDataEdit> | |||
| <div id="customer-data-edit-modal"> | |||
| <app-customer-data-edit #customerDataEdit (editCustomer)="editCustomerFunction($event)"></app-customer-data-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -17,9 +17,8 @@ import {AppService} from '../../../../services/app.service'; | |||
| import {IMeetingType} from '../../../../model/entities/meeting-type'; | |||
| import {IConfig} from '../../../../model/virtual/config'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {CustomerService} from '../../../../services/customer.service'; | |||
| import {null === ; } from; 'util'; | |||
| import {MeetingService} from '../../../../services/meeting.service'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| import {Const} from '../../../../utils/const'; | |||
| @@ -56,8 +55,8 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| public hasEditRights: boolean; | |||
| public hasReportRights: boolean; | |||
| constructor(public appService: AppService, private customerService: CustomerService, private meetingService: MeetingService, protected scrollToService: ScrollToService, private ref: ChangeDetectorRef) { | |||
| super(scrollToService); | |||
| constructor(public appService: AppService, private customerService: CustomerService, private meetingService: MeetingService, /*protected scrollToService: ScrollToService,*/ private ref: ChangeDetectorRef) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -79,8 +78,6 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Set data | |||
| * @param customer | |||
| * @param customerMeeting | |||
| */ | |||
| public setData(customer: ICustomer, customerMeeting: ICustomerMeeting): void { | |||
| this.customer = customer; | |||
| @@ -97,16 +94,15 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Updates data | |||
| * @param customer | |||
| */ | |||
| public updateData(customer: ICustomer): void { | |||
| this.customer = customer; | |||
| 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]; | |||
| if (null !== this.customerMeeting.id){ | |||
| this.customer.v_customer_meetings.forEach(item => { | |||
| if (item.id === this.customerMeeting.id) { | |||
| this.customerMeeting = item; | |||
| } | |||
| } | |||
| }); | |||
| this.setMeetingData(); | |||
| } | |||
| } | |||
| @@ -114,16 +110,16 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Sets variables for meeting | |||
| */ | |||
| public setMeetingData(); { | |||
| public setMeetingData(): void { | |||
| this.errorMsg = ''; | |||
| this.reportFormVisible = false; | |||
| this.reportOld = this.customerMeeting.report; | |||
| this.creator = this.appService.getConfig().vc_user_by_id[this.customerMeeting.creation_user_id]; | |||
| this.owner = this.appService.getConfig().vc_user_by_id[this.customerMeeting.owner_user_id]; | |||
| this.participants = []; | |||
| for (let i = 0; i < this.customerMeeting.v_participants.length; i++) { | |||
| this.participants.push(this.appService.getConfig().vc_user_by_id[this.customerMeeting.v_participants[i].participant_user_id]); | |||
| } | |||
| this.customerMeeting.v_participants.forEach(item => { | |||
| this.participants.push(this.appService.getConfig().vc_user_by_id[item.participant_user_id]); | |||
| }); | |||
| this.meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.customerMeeting.meeting_type_id]; | |||
| this.date = Utils.getDateTimeToDisplay(this.customerMeeting.start_date); | |||
| this.timeStart = Utils.getDateTimeToDisplay(this.customerMeeting.start_date, false, true); | |||
| @@ -137,25 +133,24 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Edit meeting entry | |||
| */ | |||
| public editEntry(); : void { | |||
| public editEntry(): void { | |||
| this.isEditMode = true; | |||
| this.customerMeetingDetailEdit.setData(this.customer, Utils.deepClone(this.customerMeeting) as ICustomerMeeting); | |||
| }; | |||
| } | |||
| /** | |||
| * Edits meeting entry | |||
| * @param customerMeeting | |||
| */ | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting); { | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting): void { | |||
| this.editMeeting.emit(customerMeeting); | |||
| } | |||
| /** | |||
| * Delete meeting entry | |||
| */ | |||
| public deleteEntry(); : void { | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Eintrag wirklich löschen?'); | |||
| if(confirmAction == true; ) { | |||
| if (confirmAction === true) { | |||
| this.deleteMeeting.emit(this.customerMeeting.id); | |||
| } | |||
| } | |||
| @@ -163,44 +158,42 @@ export class CustomerMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Check if edit report after meeting has started | |||
| */ | |||
| public editReport(); : void { | |||
| public editReport(): void { | |||
| this.meetingService.apiCheckCustomerMeetingReport(this.customerMeeting.id).subscribe( | |||
| data => { | |||
| this.reportFormVisible = data.result_data as boolean; | |||
| // NOTE: We need manual change detection in this component | |||
| this.ref.detectChanges(); | |||
| this.scrollUp('customer-meeting-edit-report'); | |||
| // todo this.scrollUp('customer-meeting-edit-report'); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| }; | |||
| } | |||
| /** | |||
| * Resets Form Validation | |||
| */ | |||
| public resetFormValidation(); : void { | |||
| if(this.reportFormVisible); { | |||
| public resetFormValidation(): void { | |||
| if (this.reportFormVisible) { | |||
| this.customerMeetingReportForm.form.markAsUntouched(); | |||
| } | |||
| } | |||
| /** | |||
| * Saves customer meeting report | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }); : void { | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| if(valid) { | |||
| if (valid) { | |||
| this.editMeetingReport.emit({ | |||
| id: this.customerMeeting.id, | |||
| report: this.customerMeeting.report | |||
| }); | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp('customer-meeting-edit-report'); | |||
| // todo this.scrollUp('customer-meeting-edit-report'); | |||
| } | |||
| }; | |||
| } | |||
| } | |||
| @@ -2,7 +2,7 @@ import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core' | |||
| import {NgForm} from '@angular/forms'; | |||
| import {ICustomerMeeting} from '../../../../model/entities/customer-meeting'; | |||
| import {ICustomer} from '../../../../model/entities/customer'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {Factory} from '../../../../factory/factory'; | |||
| import {ICustomerContact} from '../../../../model/entities/customer-contact'; | |||
| import {Utils} from '../../../../utils/utils'; | |||
| @@ -43,8 +43,8 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| public contactPersonValue: string; | |||
| public config: IConfig; | |||
| constructor(public appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| constructor(public appService: AppService, /*protected scrollToService: ScrollToService*/) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -70,9 +70,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Sets data | |||
| * @param customer | |||
| * @param customerMeeting | |||
| * @param isCreationMode | |||
| */ | |||
| public setData(customer: ICustomer, customerMeeting: ICustomerMeeting, isCreationMode: boolean = false): void { | |||
| this.customer = customer; | |||
| @@ -123,7 +120,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select contact | |||
| * @param e | |||
| */ | |||
| public selectContact(e: any) { | |||
| this.customerMeeting.customer_contact_id = e.target.value; | |||
| @@ -149,7 +145,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select owner | |||
| * @param e | |||
| */ | |||
| public selectOwner(e: any) { | |||
| if (e.target.value !== '0: null') { | |||
| @@ -170,7 +165,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select meeting type | |||
| * @param e | |||
| */ | |||
| public selectMeetingType(e: any) { | |||
| this.customerMeeting.meeting_type_id = e.target.value; | |||
| @@ -178,7 +172,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select participant | |||
| * @param e | |||
| */ | |||
| public participantsChange(e: any) { | |||
| const participantUserId: number = parseInt(e.target.value); | |||
| @@ -199,7 +192,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Checks if participant is selected | |||
| * @param id | |||
| */ | |||
| public checkParticipants(id: number) { | |||
| return this.selectedParticipantsById.hasOwnProperty(id); | |||
| @@ -214,8 +206,6 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Saves customer meeting | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| @@ -224,7 +214,7 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| // 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); | |||
| // todo this.scrollUp(identifier); | |||
| } else { | |||
| this.customerMeeting.start_date = this.startDate + ' ' + this.timeStart + ':00'; | |||
| this.customerMeeting.end_date = this.startDate + ' ' + this.timeEnd + ':00'; | |||
| @@ -235,7 +225,7 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| this.customerMeeting.v_participants.push(this.selectedParticipantsById[spId]); | |||
| } | |||
| if (this.customerMeeting.customer_contact_id == -1) { | |||
| if (this.customerMeeting.customer_contact_id === -1) { | |||
| this.customerMeeting.customer_contact_id = null; | |||
| } | |||
| @@ -247,11 +237,11 @@ export class CustomerMeetingEditComponent extends FormComponent implements OnIni | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(identifier); | |||
| // todo this.scrollUp(identifier); | |||
| } | |||
| } | |||
| } else { | |||
| this.scrollUp(identifier); | |||
| // todo this.scrollUp(identifier); | |||
| } | |||
| } | |||
| @@ -20,14 +20,14 @@ | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerMeetingDetail> | |||
| <app-spt-modal [overlay]="true" #modalCustomerMeetingDetail> | |||
| <app-customer-meeting-detail #customerMeetingDetail (editMeeting)="editCustomerMeetingFunction($event)" | |||
| (deleteMeeting)="deleteCustomerMeetingFunction($event)" | |||
| (editMeetingReport)="editCustomerMeetingReportFunction($event)"></app-customer-meeting-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| <app-modal [overlay]="true" #modalCustomerMeetingEdit> | |||
| <app-spt-modal [overlay]="true" #modalCustomerMeetingEdit> | |||
| <div id="customer-meeting-modal"> | |||
| <app-customer-meeting-edit #customerMeetingEdit (createMeeting)="createCustomerMeetingFunction($event)"></app-customer-meeting-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -87,8 +87,6 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Sets data | |||
| * @param customer | |||
| * @param isUpdate | |||
| */ | |||
| public setData(customer: ICustomer, isUpdate: boolean): void { | |||
| this.customer = customer; | |||
| @@ -139,13 +137,12 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| phone: value.phone_no, | |||
| mobile: value.mobile_no, | |||
| }); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a.date, b.date, false)); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['date'], b['date'], false)); | |||
| }); | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalCustomerMeetingDetail.openModal(); | |||
| @@ -162,7 +159,6 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Creates customer meeting | |||
| * @param customerMeeting | |||
| */ | |||
| public createCustomerMeetingFunction(customerMeeting: ICustomerMeeting): void { | |||
| this.createMeeting.emit(customerMeeting); | |||
| @@ -170,7 +166,6 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Edits meeting entry | |||
| * @param customerMeeting | |||
| */ | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting) { | |||
| this.editMeeting.emit(customerMeeting); | |||
| @@ -178,7 +173,6 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Deletes customer meeting | |||
| * @param meetingId | |||
| */ | |||
| public deleteCustomerMeetingFunction(meetingId: number): void { | |||
| this.deleteMeeting.emit(meetingId); | |||
| @@ -186,7 +180,6 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||
| /** | |||
| * Edit report after meeting has started | |||
| * @param reportValues | |||
| */ | |||
| public editCustomerMeetingReportFunction(reportValues: any): void { | |||
| this.editMeetingReport.emit(reportValues); | |||
| @@ -5,7 +5,7 @@ import {Factory} from '../../../../factory/factory'; | |||
| 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 {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {FormComponent} from '../../../../components/form-component'; | |||
| @Component({ | |||
| @@ -27,8 +27,8 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| public isExistingCustomerContact: boolean; | |||
| public contactId: string; | |||
| constructor(protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| constructor(/* protected scrollToService: ScrollToService */) { | |||
| super(/* scrollToService */); | |||
| } | |||
| ngOnInit() { | |||
| @@ -44,9 +44,6 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| /** | |||
| * Sets data | |||
| * @param customer | |||
| * @param customerNote | |||
| * @param isCreationMode | |||
| */ | |||
| public setData(customer: ICustomer, customerNote: ICustomerNote, isCreationMode = false): void { | |||
| this.customer = customer; | |||
| @@ -68,7 +65,6 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| /** | |||
| * On select contact | |||
| * @param e | |||
| */ | |||
| public selectContact(e: any) { | |||
| this.customerNote.customer_contact_id = e.target.value; | |||
| @@ -103,8 +99,6 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| /** | |||
| * Saves customer | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| @@ -119,7 +113,7 @@ export class CustomerNoteEditComponent extends FormComponent implements OnInit { | |||
| } | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp(this.isCreationMode ? 'customer-note-modal' : 'customer-note-edit-modal'); | |||
| // todo this.scrollUp(this.isCreationMode ? 'customer-note-modal' : 'customer-note-edit-modal'); | |||
| } | |||
| } | |||
| @@ -20,13 +20,13 @@ | |||
| </ag-grid-angular> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerNoteDetail> | |||
| <app-spt-modal [overlay]="true" #modalCustomerNoteDetail> | |||
| <app-customer-note-detail #customerNoteDetail (editNote)="editCustomerNoteFunction($event)" | |||
| (deleteNote)="deleteCustomerNoteFunction($event)"></app-customer-note-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| <app-modal [overlay]="true" #modalCustomerNoteEdit> | |||
| <app-spt-modal [overlay]="true" #modalCustomerNoteEdit> | |||
| <div id="customer-note-modal"> | |||
| <app-customer-note-edit #customerNoteEdit (createNote)="createCustomerNoteFunction($event)"></app-customer-note-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -65,8 +65,6 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||
| /** | |||
| * Sets data | |||
| * @param customer | |||
| * @param isUpdate | |||
| */ | |||
| public setData(customer: ICustomer, isUpdate: boolean): void { | |||
| this.customer = customer; | |||
| @@ -87,38 +85,37 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||
| public generateEntries(): void { | |||
| this.rowData = []; | |||
| const items: {}[] = []; | |||
| for (let i = 0; i < this.customerNote.length; i++) { | |||
| for (const item of this.customerNote) { | |||
| let ccGender = ''; | |||
| if (this.customerNote[i].gender == 'male') { | |||
| if (item.gender === 'male') { | |||
| ccGender = 'Herr'; | |||
| } else if (this.customerNote[i].gender == 'female') { | |||
| } else if (item.gender === 'female') { | |||
| ccGender = 'Frau'; | |||
| } else if (this.customerNote[i].gender == 'diverse') { | |||
| } else if (item.gender === 'diverse') { | |||
| ccGender = 'Divers'; | |||
| } | |||
| items.push({ | |||
| id: this.customerNote[i].id, | |||
| date: this.customerNote[i].note_date, | |||
| title: this.customerNote[i].title, | |||
| comment: this.customerNote[i].comment, | |||
| id: item.id, | |||
| date: item.note_date, | |||
| title: item.title, | |||
| comment: item.comment, | |||
| gender: ccGender, | |||
| firstname: this.customerNote[i].firstname, | |||
| lastname: this.customerNote[i].lastname, | |||
| email: this.customerNote[i].email, | |||
| phone_no: this.customerNote[i].phone_no, | |||
| mobile_no: this.customerNote[i].mobile_no, | |||
| fax_no: this.customerNote[i].fax_no, | |||
| department: this.customerNote[i].department, | |||
| creation_date: this.customerNote[i].creation_date, | |||
| creator: this.customerNote[i].creation_user_firstname + ' ' + this.customerNote[i].creation_user_lastname, | |||
| firstname: item.firstname, | |||
| lastname: item.lastname, | |||
| email: item.email, | |||
| phone_no: item.phone_no, | |||
| mobile_no: item.mobile_no, | |||
| fax_no: item.fax_no, | |||
| department: item.department, | |||
| creation_date: item.creation_date, | |||
| creator: item.creation_user_firstname + ' ' + item.creation_user_lastname, | |||
| }); | |||
| } | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a.date, b.date, false)); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['date'], b['date'], false)); | |||
| } | |||
| /** | |||
| * On row click | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any) { | |||
| this.modalCustomerNoteDetail.openModal(); | |||
| @@ -135,7 +132,6 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||
| /** | |||
| * Creates customer note | |||
| * @param customerNote | |||
| */ | |||
| public createCustomerNoteFunction(customerNote: ICustomerNote): void { | |||
| this.createNote.emit(customerNote); | |||
| @@ -143,7 +139,6 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||
| /** | |||
| * Edits note entry | |||
| * @param customerNote | |||
| */ | |||
| public editCustomerNoteFunction(customerNote: ICustomerNote) { | |||
| this.editNote.emit(customerNote); | |||
| @@ -151,7 +146,6 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||
| /** | |||
| * Deletes customer note | |||
| * @param noteId | |||
| */ | |||
| public deleteCustomerNoteFunction(noteId: number): void { | |||
| this.deleteNote.emit(noteId); | |||
| @@ -16,7 +16,7 @@ import {IConfig} from '../../../model/virtual/config'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {IUser} from '../../../model/entities/user'; | |||
| import {FormComponent} from '../../../components/form-component'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {MeetingService} from '../../../services/meeting.service'; | |||
| import {Const} from '../../../utils/const'; | |||
| @@ -51,8 +51,8 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| public reportOld: string; | |||
| public hasAdminRights: boolean; | |||
| constructor(public appService: AppService, private meetingService: MeetingService, protected scrollToService: ScrollToService, private ref: ChangeDetectorRef) { | |||
| super(scrollToService); | |||
| constructor(public appService: AppService, private meetingService: MeetingService, /*protected scrollToService: ScrollToService,*/ private ref: ChangeDetectorRef) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -74,7 +74,6 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Set data | |||
| * @param internalMeeting | |||
| */ | |||
| public setData(internalMeeting: IInternalMeeting): void { | |||
| this.internalMeeting = internalMeeting; | |||
| @@ -83,7 +82,6 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Updates data | |||
| * @param internalMeeting | |||
| */ | |||
| public updateData(internalMeeting: IInternalMeeting): void { | |||
| if (null !== this.internalMeeting.id) { | |||
| @@ -125,7 +123,6 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Edits meeting entry | |||
| * @param internalMeeting | |||
| */ | |||
| public editInternalMeetingFunction(internalMeeting: IInternalMeeting) { | |||
| this.editMeeting.emit(internalMeeting); | |||
| @@ -136,7 +133,7 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| */ | |||
| public deleteEntry(): void { | |||
| const confirmAction = confirm('Wollen Sie diesen Eintrag wirklich löschen?'); | |||
| if (confirmAction == true) { | |||
| if (confirmAction === true) { | |||
| this.deleteMeeting.emit(this.internalMeeting.id); | |||
| } | |||
| } | |||
| @@ -150,7 +147,7 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| this.reportFormVisible = data.result_data as boolean; | |||
| // NOTE: We need manual change detection in this component | |||
| this.ref.detectChanges(); | |||
| this.scrollUp('internal-meeting-edit-report'); | |||
| // todo this.scrollUp('internal-meeting-edit-report'); | |||
| }, | |||
| error => { | |||
| } | |||
| @@ -168,8 +165,6 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| /** | |||
| * Saves internal meeting report | |||
| * @param value | |||
| * @param valid | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| @@ -180,7 +175,7 @@ export class InternalMeetingDetailComponent extends FormComponent implements OnI | |||
| }); | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.scrollUp('internal-meeting-edit-report'); | |||
| // todo this.scrollUp('internal-meeting-edit-report'); | |||
| } | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; | |||
| import {IConfig} from '../../../model/virtual/config'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| // import {ScrollToService} from '@nicky-lenaers/ngx-scroll-to'; | |||
| import {NgForm} from '@angular/forms'; | |||
| import {Factory} from '../../../factory/factory'; | |||
| import {IInternalMeeting} from '../../../model/entities/internal-meeting'; | |||
| @@ -36,8 +36,8 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| public timeEnd: string; | |||
| public config: IConfig; | |||
| constructor(public appService: AppService, protected scrollToService: ScrollToService) { | |||
| super(scrollToService); | |||
| constructor(public appService: AppService, /*protected scrollToService: ScrollToService*/) { | |||
| super(/*scrollToService*/); | |||
| } | |||
| ngOnInit() { | |||
| @@ -59,8 +59,6 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Sets data | |||
| * @param internalMeeting | |||
| * @param isCreationMode | |||
| */ | |||
| public setData(internalMeeting: IInternalMeeting, isCreationMode = false): void { | |||
| this.internalMeeting = internalMeeting; | |||
| @@ -102,7 +100,6 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select owner | |||
| * @param e | |||
| */ | |||
| public selectOwner(e: any) { | |||
| if (e.target.value !== '0: null') { | |||
| @@ -123,7 +120,6 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * On select participant | |||
| * @param e | |||
| */ | |||
| public participantsChange(e: any) { | |||
| const participantUserId: number = parseInt(e.target.value); | |||
| @@ -144,7 +140,6 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Checks if participant is selected | |||
| * @param id | |||
| */ | |||
| public checkParticipants(id: number) { | |||
| if (this.selectedParticipantsById.hasOwnProperty(id)) { | |||
| @@ -163,7 +158,6 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| /** | |||
| * Saves internal meeting | |||
| * @param value | |||
| */ | |||
| public onFormSubmit({value, valid}: { value: any, valid: boolean }): void { | |||
| this.errorMsg = 'Bitte beheben Sie alle Fehler.'; | |||
| @@ -174,7 +168,7 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| const compareDateEnd = new Date(this.dateEnd + 'T' + this.timeEnd + ':00'); | |||
| if (compareDateStart > compareDateEnd) { | |||
| this.errorMsg = 'Datum / Zeit (Ende) darf nicht vor Datum / Zeit (Start) liegen.'; | |||
| this.scrollUp(identifier); | |||
| // todo this.scrollUp(identifier); | |||
| } else { | |||
| this.internalMeeting.start_date = this.dateStart + ' ' + this.timeStart + ':00'; | |||
| this.internalMeeting.end_date = this.dateEnd + ' ' + this.timeEnd + ':00'; | |||
| @@ -193,11 +187,11 @@ export class InternalMeetingEditComponent extends FormComponent implements OnIni | |||
| this.errorMsg = ''; | |||
| } else { | |||
| this.errorMsg = 'Bitte korrektes Datum eingeben.'; | |||
| this.scrollUp(identifier); | |||
| // todo this.scrollUp(identifier); | |||
| } | |||
| } | |||
| } else { | |||
| this.scrollUp(identifier); | |||
| // todo this.scrollUp(identifier); | |||
| } | |||
| } | |||
| @@ -9,12 +9,6 @@ import {Utils} from '../../../utils/utils'; | |||
| import {IUser} from '../../../model/entities/user'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {IInternalMeeting} from '../../../model/entities/internal-meeting'; | |||
| import {IOperatorMeeting} from '../../../model/entities/operator-meeting'; | |||
| import {IOperator} from '../../../model/entities/operator'; | |||
| import {IProductionMeeting} from '../../../model/entities/production-meeting'; | |||
| import {IServiceMeeting} from '../../../model/entities/service-meeting'; | |||
| import {IProduction} from '../../../model/entities/production'; | |||
| import {IService} from '../../../model/entities/service'; | |||
| const colors: any = { | |||
| colorCustomer: { | |||
| @@ -52,15 +46,9 @@ export class MeetingCalendarComponent implements OnInit { | |||
| static MEETING_TYPE_CUSTOMER = 'customer_meeting'; | |||
| static MEETING_TYPE_INTERNAL = 'internal_meeting'; | |||
| static MEETING_TYPE_OPERATOR = 'operator_meeting'; | |||
| static MEETING_TYPE_PRODUCTION = 'production_meeting'; | |||
| static MEETING_TYPE_SERVICE = 'service_meeting'; | |||
| @Output() editCustomerMeeting: EventEmitter<ICustomerMeeting> = new EventEmitter<ICustomerMeeting>(); | |||
| @Output() editOperatorMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() editInternalMeeting: EventEmitter<IInternalMeeting> = new EventEmitter<IInternalMeeting>(); | |||
| @Output() editProductionMeeting: EventEmitter<IProductionMeeting> = new EventEmitter<IProductionMeeting>(); | |||
| @Output() editServiceMeeting: EventEmitter<IServiceMeeting> = new EventEmitter<IServiceMeeting>(); | |||
| @ViewChild('modalContent', { static: true }) modalContent: TemplateRef<any>; | |||
| @@ -81,18 +69,9 @@ export class MeetingCalendarComponent implements OnInit { | |||
| public activeDayIsOpen: boolean; | |||
| private customerMeetings: ICustomerMeeting[]; | |||
| private internalMeetings: IInternalMeeting[]; | |||
| private operatorMeetings: IOperatorMeeting[]; | |||
| private productionMeetings: IProductionMeeting[]; | |||
| private serviceMeetings: IServiceMeeting[]; | |||
| private customerMeetingsById: {}; | |||
| private internalMeetingsById: {}; | |||
| private operatorMeetingsById: {}; | |||
| private productionMeetingsById: {}; | |||
| private serviceMeetingsById: {}; | |||
| private customersById: {}; | |||
| private operatorsById: {}; | |||
| private productionsById: {}; | |||
| private servicesById: {}; | |||
| public users: IUser[]; | |||
| public usersById: {}; | |||
| public selectableUsers: IUser[]; | |||
| @@ -103,16 +82,7 @@ export class MeetingCalendarComponent implements OnInit { | |||
| this.customerMeetingsById = {}; | |||
| this.internalMeetings = []; | |||
| this.internalMeetingsById = {}; | |||
| this.operatorMeetings = []; | |||
| this.operatorMeetingsById = {}; | |||
| this.productionMeetings = []; | |||
| this.productionMeetingsById = {}; | |||
| this.serviceMeetings = []; | |||
| this.serviceMeetingsById = {}; | |||
| this.customersById = {}; | |||
| this.operatorsById = {}; | |||
| this.productionsById = {}; | |||
| this.servicesById = {}; | |||
| this.activeDayIsOpen = false; | |||
| this.actions = [ | |||
| { | |||
| @@ -135,19 +105,10 @@ export class MeetingCalendarComponent implements OnInit { | |||
| */ | |||
| public setData( | |||
| customersById: {}, | |||
| operatorsById: {}, | |||
| productionsById: {}, | |||
| servicesById: {}, | |||
| customerMeetings: ICustomerMeeting[], | |||
| internalMeetings: IInternalMeeting[], | |||
| operatorMeetings: IOperatorMeeting[], | |||
| productionMeetings: IProductionMeeting[], | |||
| serviceMeetings: IServiceMeeting[] | |||
| ) { | |||
| this.customersById = customersById; | |||
| this.operatorsById = operatorsById; | |||
| this.productionsById = productionsById; | |||
| this.servicesById = servicesById; | |||
| this.users = this.appService.getConfig().users; | |||
| this.usersById = this.appService.getConfig().vc_user_by_id; | |||
| this.activeDayIsOpen = false; | |||
| @@ -155,18 +116,12 @@ export class MeetingCalendarComponent implements OnInit { | |||
| this.customerMeetingsById = Utils.getSortedObjFromArray(this.customerMeetings, 'id'); | |||
| this.internalMeetings = internalMeetings; | |||
| this.internalMeetingsById = Utils.getSortedObjFromArray(this.internalMeetings, 'id'); | |||
| this.operatorMeetings = operatorMeetings; | |||
| this.operatorMeetingsById = Utils.getSortedObjFromArray(this.operatorMeetings, 'id'); | |||
| this.productionMeetings = productionMeetings; | |||
| this.productionMeetingsById = Utils.getSortedObjFromArray(this.productionMeetings, 'id'); | |||
| this.serviceMeetings = serviceMeetings; | |||
| this.serviceMeetingsById = Utils.getSortedObjFromArray(this.serviceMeetings, 'id'); | |||
| this.selectableUsers = []; | |||
| for (let i = 0; i < this.users.length; i++) { | |||
| if (this.users[i].active === true) { | |||
| this.selectableUsers.push(this.users[i]); | |||
| this.users.forEach(item => { | |||
| if (item.active === true) { | |||
| this.selectableUsers.push(item); | |||
| } | |||
| } | |||
| }); | |||
| for (let k = 0; k < this.selectableUsers.length; k++) { | |||
| if (this.selectableUsers[k].id === this.appService.getAppUser().id) { | |||
| this.selectedUserIndex = k + 1; | |||
| @@ -183,32 +138,32 @@ export class MeetingCalendarComponent implements OnInit { | |||
| this.events = []; | |||
| this.closeOpenMonthViewDay(); | |||
| const filterUser: IUser = null !== this.selectedUserIndex ? this.selectableUsers[this.selectedUserIndex - 1] : null; | |||
| for (let c = 0; c < this.customerMeetings.length; c++) { | |||
| this.customerMeetings.forEach(item => { | |||
| if (null !== filterUser) { | |||
| if (filterUser.id !== this.customerMeetings[c].owner_user_id) { | |||
| if (filterUser.id !== item.owner_user_id) { | |||
| let isParticipant = false; | |||
| for (let p = 0; p < this.customerMeetings[c].v_participants.length; p++) { | |||
| if (filterUser.id === this.customerMeetings[c].v_participants[p].participant_user_id) { | |||
| item.v_participants.forEach(item1 => { | |||
| if (filterUser.id === item1.participant_user_id) { | |||
| isParticipant = true; | |||
| } | |||
| } | |||
| }); | |||
| if (!isParticipant) { | |||
| // Don't show this meeting, since it does not involve filtered user | |||
| continue; | |||
| return; | |||
| } | |||
| } | |||
| } | |||
| const customer: ICustomer = this.customersById[this.customerMeetings[c].customer_id]; | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[this.customerMeetings[c].owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(this.customerMeetings[c].start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(this.customerMeetings[c].end_date, true, true) + ' - ' + | |||
| const customer: ICustomer = this.customersById[item.customer_id]; | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[item.owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(item.start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(item.end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + | |||
| customer.name + ' [' + this.customerMeetings[c].title + ']'; | |||
| customer.name + ' [' + item.title + ']'; | |||
| this.events.push( | |||
| { | |||
| id: MeetingCalendarComponent.MEETING_TYPE_CUSTOMER + ':' + this.customerMeetings[c].id, | |||
| start: addHours(Utils.getParsedDate(this.customerMeetings[c].start_date), 1), | |||
| end: addHours(Utils.getParsedDate(this.customerMeetings[c].end_date), 1), | |||
| id: MeetingCalendarComponent.MEETING_TYPE_CUSTOMER + ':' + item.id, | |||
| start: addHours(Utils.getParsedDate(item.start_date), 1), | |||
| end: addHours(Utils.getParsedDate(item.end_date), 1), | |||
| title, | |||
| color: colors.colorCustomer, | |||
| actions: this.actions, | |||
| @@ -220,33 +175,33 @@ export class MeetingCalendarComponent implements OnInit { | |||
| draggable: false | |||
| } | |||
| ); | |||
| } | |||
| }); | |||
| for (let i = 0; i < this.internalMeetings.length; i++) { | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[this.internalMeetings[i].owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(this.internalMeetings[i].start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(this.internalMeetings[i].end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + 'PLP intern [' + this.internalMeetings[i].title + ']'; | |||
| this.internalMeetings.forEach(item => { | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[item.owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(item.start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(item.end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + 'PLP intern [' + item.title + ']'; | |||
| if (null !== filterUser) { | |||
| if (filterUser.id !== this.internalMeetings[i].owner_user_id) { | |||
| if (filterUser.id !== item.owner_user_id) { | |||
| let isParticipant = false; | |||
| for (let p = 0; p < this.internalMeetings[i].v_participants.length; p++) { | |||
| if (filterUser.id === this.internalMeetings[i].v_participants[p].participant_user_id) { | |||
| item.v_participants.forEach(item1 => { | |||
| if (filterUser.id === item1.participant_user_id) { | |||
| isParticipant = true; | |||
| } | |||
| } | |||
| }); | |||
| if (!isParticipant) { | |||
| // Don't show this meeting, since it does not involve filtered user | |||
| continue; | |||
| return; | |||
| } | |||
| } | |||
| } | |||
| this.events.push( | |||
| { | |||
| id: MeetingCalendarComponent.MEETING_TYPE_INTERNAL + ':' + this.internalMeetings[i].id, | |||
| start: addHours(Utils.getParsedDate(this.internalMeetings[i].start_date), 1), | |||
| end: addHours(Utils.getParsedDate(this.internalMeetings[i].end_date), 1), | |||
| id: MeetingCalendarComponent.MEETING_TYPE_INTERNAL + ':' + item.id, | |||
| start: addHours(Utils.getParsedDate(item.start_date), 1), | |||
| end: addHours(Utils.getParsedDate(item.end_date), 1), | |||
| title, | |||
| color: colors.colorInternal, | |||
| actions: this.actions, | |||
| @@ -258,133 +213,12 @@ export class MeetingCalendarComponent implements OnInit { | |||
| draggable: false | |||
| } | |||
| ); | |||
| } | |||
| for (let o = 0; o < this.operatorMeetings.length; o++) { | |||
| const operator: IOperator = this.operatorsById[this.operatorMeetings[o].operator_id]; | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[this.operatorMeetings[o].owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(this.operatorMeetings[o].start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(this.operatorMeetings[o].end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + | |||
| operator.name + '<span style="background:red"> [' + this.operatorMeetings[o].title + ']</span>'; | |||
| if (null !== filterUser) { | |||
| if (filterUser.id !== this.operatorMeetings[o].owner_user_id) { | |||
| let isParticipant = false; | |||
| for (let p = 0; p < this.operatorMeetings[o].v_participants.length; p++) { | |||
| if (filterUser.id === this.operatorMeetings[o].v_participants[p].participant_user_id) { | |||
| isParticipant = true; | |||
| } | |||
| } | |||
| if (!isParticipant) { | |||
| // Don't show this meeting, since it does not involve filtered user | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| this.events.push( | |||
| { | |||
| id: MeetingCalendarComponent.MEETING_TYPE_OPERATOR + ':' + this.operatorMeetings[o].id, | |||
| start: addHours(Utils.getParsedDate(this.operatorMeetings[o].start_date), 1), | |||
| end: addHours(Utils.getParsedDate(this.operatorMeetings[o].end_date), 1), | |||
| title, | |||
| color: colors.colorOperators, | |||
| actions: this.actions, | |||
| allDay: false, | |||
| resizable: { | |||
| beforeStart: true, | |||
| afterEnd: true | |||
| }, | |||
| draggable: false | |||
| } | |||
| ); | |||
| } | |||
| for (let pr = 0; pr < this.productionMeetings.length; pr++) { | |||
| const production: IProduction = this.productionsById[this.productionMeetings[pr].production_id]; | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[this.productionMeetings[pr].owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(this.productionMeetings[pr].start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(this.productionMeetings[pr].end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + | |||
| production.name + '<span style="background:red"> [' + this.productionMeetings[pr].title + ']</span>'; | |||
| if (null !== filterUser) { | |||
| if (filterUser.id !== this.productionMeetings[pr].owner_user_id) { | |||
| let isParticipant = false; | |||
| for (let p = 0; p < this.productionMeetings[pr].v_participants.length; p++) { | |||
| if (filterUser.id === this.productionMeetings[pr].v_participants[p].participant_user_id) { | |||
| isParticipant = true; | |||
| } | |||
| } | |||
| if (!isParticipant) { | |||
| // Don't show this meeting, since it does not involve filtered user | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| this.events.push( | |||
| { | |||
| id: MeetingCalendarComponent.MEETING_TYPE_PRODUCTION + ':' + this.productionMeetings[pr].id, | |||
| start: addHours(Utils.getParsedDate(this.productionMeetings[pr].start_date), 1), | |||
| end: addHours(Utils.getParsedDate(this.productionMeetings[pr].end_date), 1), | |||
| title, | |||
| color: colors.colorProduction, | |||
| actions: this.actions, | |||
| allDay: false, | |||
| resizable: { | |||
| beforeStart: true, | |||
| afterEnd: true | |||
| }, | |||
| draggable: false | |||
| } | |||
| ); | |||
| } | |||
| for (let se = 0; se < this.serviceMeetings.length; se++) { | |||
| const service: IService = this.servicesById[this.serviceMeetings[se].service_id]; | |||
| const user: IUser = this.appService.getConfig().vc_user_by_id[this.serviceMeetings[se].owner_user_id]; | |||
| const title: string = Utils.getDateTimeToDisplay(this.serviceMeetings[se].start_date, true, true) + ' bis ' + | |||
| Utils.getDateTimeToDisplay(this.serviceMeetings[se].end_date, true, true) + ' - ' + | |||
| user.firstname + ' ' + user.lastname + ': ' + | |||
| service.name + '<span style="background:red"> [' + this.serviceMeetings[se].title + ']</span>'; | |||
| if (null !== filterUser) { | |||
| if (filterUser.id !== this.serviceMeetings[se].owner_user_id) { | |||
| let isParticipant = false; | |||
| for (let p = 0; p < this.serviceMeetings[se].v_participants.length; p++) { | |||
| if (filterUser.id === this.serviceMeetings[se].v_participants[p].participant_user_id) { | |||
| isParticipant = true; | |||
| } | |||
| } | |||
| if (!isParticipant) { | |||
| // Don't show this meeting, since it does not involve filtered user | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| this.events.push( | |||
| { | |||
| id: MeetingCalendarComponent.MEETING_TYPE_SERVICE + ':' + this.serviceMeetings[se].id, | |||
| start: addHours(Utils.getParsedDate(this.serviceMeetings[se].start_date), 1), | |||
| end: addHours(Utils.getParsedDate(this.serviceMeetings[se].end_date), 1), | |||
| title, | |||
| color: colors.colorService, | |||
| actions: this.actions, | |||
| allDay: false, | |||
| resizable: { | |||
| beforeStart: true, | |||
| afterEnd: true | |||
| }, | |||
| draggable: false | |||
| } | |||
| ); | |||
| } | |||
| }); | |||
| this.refresh.next(); | |||
| } | |||
| /** | |||
| * Day is clicked | |||
| * @param date | |||
| * @param events | |||
| */ | |||
| public dayClicked({ date, events }: { date: Date; events: CalendarEvent[] }): void { | |||
| if (isSameMonth(date, this.viewDate)) { | |||
| @@ -402,9 +236,6 @@ export class MeetingCalendarComponent implements OnInit { | |||
| /** | |||
| * Times changed event | |||
| * @param event | |||
| * @param newStart | |||
| * @param newEnd | |||
| */ | |||
| eventTimesChanged({ | |||
| event, | |||
| @@ -426,8 +257,6 @@ export class MeetingCalendarComponent implements OnInit { | |||
| /** | |||
| * Handles event | |||
| * @param action | |||
| * @param event | |||
| */ | |||
| public handleEvent(action: string, event: CalendarEvent): void { | |||
| this.modalData = { event, action }; | |||
| @@ -441,15 +270,6 @@ export class MeetingCalendarComponent implements OnInit { | |||
| case MeetingCalendarComponent.MEETING_TYPE_INTERNAL: | |||
| this.editInternalMeeting.emit(this.internalMeetingsById[idComponents[1]] as IInternalMeeting); | |||
| break; | |||
| case MeetingCalendarComponent.MEETING_TYPE_OPERATOR: | |||
| this.editOperatorMeeting.emit(this.operatorMeetingsById[idComponents[1]] as IOperatorMeeting); | |||
| break; | |||
| case MeetingCalendarComponent.MEETING_TYPE_PRODUCTION: | |||
| this.editProductionMeeting.emit(this.productionMeetingsById[idComponents[1]] as IProductionMeeting); | |||
| break; | |||
| case MeetingCalendarComponent.MEETING_TYPE_SERVICE: | |||
| this.editServiceMeeting.emit(this.serviceMeetingsById[idComponents[1]] as IServiceMeeting); | |||
| break; | |||
| } | |||
| } | |||
| @@ -475,7 +295,6 @@ export class MeetingCalendarComponent implements OnInit { | |||
| /** | |||
| * Delete event | |||
| * @param eventToDelete | |||
| */ | |||
| public deleteEvent(eventToDelete: CalendarEvent) { | |||
| this.events = this.events.filter(event => event !== eventToDelete); | |||
| @@ -483,7 +302,6 @@ export class MeetingCalendarComponent implements OnInit { | |||
| /** | |||
| * Set view | |||
| * @param view | |||
| */ | |||
| public setView(view: CalendarView) { | |||
| this.view = view; | |||
| @@ -22,7 +22,6 @@ | |||
| [suppressCellSelection]="true" | |||
| [animateRows]="true" | |||
| [rowSelection]="rowSelection" | |||
| [rowDeselection]="true" | |||
| (gridReady)="onGridReady($event)" | |||
| (rowClicked)="rowClicked($event)" | |||
| > | |||
| @@ -6,14 +6,8 @@ import {IUser} from '../../../model/entities/user'; | |||
| import {IMeetingType} from '../../../model/entities/meeting-type'; | |||
| import {AppService} from '../../../services/app.service'; | |||
| import {IInternalMeeting} from '../../../model/entities/internal-meeting'; | |||
| import {IOperatorMeeting} from '../../../model/entities/operator-meeting'; | |||
| import {IOperator} from '../../../model/entities/operator'; | |||
| import {MeetingService} from '../../../services/meeting.service'; | |||
| import {Utils} from '../../../utils/utils'; | |||
| import {IProductionMeeting} from '../../../model/entities/production-meeting'; | |||
| import {IServiceMeeting} from '../../../model/entities/service-meeting'; | |||
| import {IProduction} from '../../../model/entities/production'; | |||
| import {IService} from '../../../model/entities/service'; | |||
| @Component({ | |||
| selector: 'app-meeting-list', | |||
| @@ -24,16 +18,10 @@ import {IService} from '../../../model/entities/service'; | |||
| export class MeetingListComponent extends AgGridComponent implements OnInit, OnDestroy { | |||
| @Output() editCustomerMeeting: EventEmitter<ICustomerMeeting> = new EventEmitter<ICustomerMeeting>(); | |||
| @Output() editOperatorMeeting: EventEmitter<IOperatorMeeting> = new EventEmitter<IOperatorMeeting>(); | |||
| @Output() editInternalMeeting: EventEmitter<IInternalMeeting> = new EventEmitter<IInternalMeeting>(); | |||
| @Output() editProductionMeeting: EventEmitter<IProductionMeeting> = new EventEmitter<IProductionMeeting>(); | |||
| @Output() editServiceMeeting: EventEmitter<IServiceMeeting> = new EventEmitter<IServiceMeeting>(); | |||
| private customerMeetings: ICustomerMeeting[]; | |||
| private internalMeetings: IInternalMeeting[]; | |||
| private operatorMeetings: IOperatorMeeting[]; | |||
| private productionMeetings: IProductionMeeting[]; | |||
| private serviceMeetings: IServiceMeeting[]; | |||
| private customersById: {}; | |||
| private operatorsById: {}; | |||
| private productionsById: {}; | |||
| @@ -51,9 +39,6 @@ export class MeetingListComponent extends AgGridComponent implements OnInit, OnD | |||
| this.servicesById = {}; | |||
| this.customerMeetings = []; | |||
| this.internalMeetings = []; | |||
| this.operatorMeetings = []; | |||
| this.productionMeetings = []; | |||
| this.serviceMeetings = []; | |||
| this.customersById = {}; | |||
| this.participants = []; | |||
| @@ -90,24 +75,12 @@ export class MeetingListComponent extends AgGridComponent implements OnInit, OnD | |||
| */ | |||
| public setData( | |||
| customersById: {}, | |||
| operatorsById: {}, | |||
| productionsById: {}, | |||
| servicesById: {}, | |||
| customerMeetings: ICustomerMeeting[], | |||
| internalMeetings: IInternalMeeting[], | |||
| operatorMeetings: IOperatorMeeting[], | |||
| productionMeetings: IProductionMeeting[], | |||
| serviceMeetings: IServiceMeeting[] | |||
| internalMeetings: IInternalMeeting[] | |||
| ): void { | |||
| this.customersById = customersById; | |||
| this.operatorsById = operatorsById; | |||
| this.productionsById = productionsById; | |||
| this.servicesById = servicesById; | |||
| this.customerMeetings = customerMeetings; | |||
| this.internalMeetings = internalMeetings; | |||
| this.operatorMeetings = operatorMeetings; | |||
| this.productionMeetings = productionMeetings; | |||
| this.serviceMeetings = serviceMeetings; | |||
| this.generateEntries(); | |||
| } | |||
| @@ -120,58 +93,58 @@ export class MeetingListComponent extends AgGridComponent implements OnInit, OnD | |||
| let owner: IUser = null; | |||
| let meetingType: IMeetingType = null; | |||
| for (let c = 0; c < this.customerMeetings.length; c++) { | |||
| owner = this.appService.getConfig().vc_user_by_id[this.customerMeetings[c].owner_user_id] as IUser; | |||
| meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.customerMeetings[c].meeting_type_id] as IMeetingType; | |||
| let customerContactName: string = null !== this.customerMeetings[c].firstname) ?; this.customerMeetings[c].firstname + ' '; : ''; | |||
| customerContactName += null !== this.customerMeetings[c].lastname; ) ? this.customerMeetings[c].lastname; : ''; | |||
| const customer: ICustomer = this.customersById[this.customerMeetings[c].customer_id]; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.customerMeetings[c].creation_user_id]; | |||
| this.customerMeetings.forEach(item => { | |||
| owner = this.appService.getConfig().vc_user_by_id[item.owner_user_id] as IUser; | |||
| meetingType = this.appService.getConfig().vc_meeting_types_by_id[item.meeting_type_id] as IMeetingType; | |||
| let customerContactName: string = null !== item.firstname ? item.firstname + ' ' : ''; | |||
| customerContactName += null !== item.lastname ? item.lastname : ''; | |||
| const customer: ICustomer = this.customersById[item.customer_id]; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[item.creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| itemType: 'customer', | |||
| objectId: customer.id, | |||
| id: this.customerMeetings[c].id, | |||
| meeting: this.customerMeetings[c], | |||
| title: this.customerMeetings[c].title, | |||
| id: item.id, | |||
| meeting: item, | |||
| title: item.title, | |||
| objectName: customer.name, | |||
| dateStart: this.customerMeetings[c].start_date, | |||
| dateEnd: this.customerMeetings[c].end_date, | |||
| dateStart: item.start_date, | |||
| dateEnd: item.end_date, | |||
| type: meetingType.name, | |||
| typeType: meetingType.type, | |||
| reportExists: this.customerMeetings[c].report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: this.customerMeetings[c].is_option_meeting, | |||
| street: this.customerMeetings[c].street, | |||
| street_no: this.customerMeetings[c].street_no, | |||
| zip: this.customerMeetings[c].zip, | |||
| city: this.customerMeetings[c].city, | |||
| reportExists: item.report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: item.is_option_meeting, | |||
| street: item.street, | |||
| street_no: item.street_no, | |||
| zip: item.zip, | |||
| city: item.city, | |||
| owner: owner.firstname + ' ' + owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| contactName: customerContactName, | |||
| participants: this.customerMeetings[c].v_participants, | |||
| department: this.customerMeetings[c].department, | |||
| email: this.customerMeetings[c].email, | |||
| phone: this.customerMeetings[c].phone_no, | |||
| mobile: this.customerMeetings[c].mobile_no, | |||
| participants: item.v_participants, | |||
| department: item.department, | |||
| email: item.email, | |||
| phone: item.phone_no, | |||
| mobile: item.mobile_no, | |||
| }); | |||
| } | |||
| for (let i = 0; i < this.internalMeetings.length; i++) { | |||
| owner = this.appService.getConfig().vc_user_by_id[this.internalMeetings[i].owner_user_id] as IUser; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.internalMeetings[i].creation_user_id]; | |||
| }); | |||
| this.internalMeetings.forEach(item => { | |||
| owner = this.appService.getConfig().vc_user_by_id[item.owner_user_id] as IUser; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[item.creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| itemType: 'internal', | |||
| objectId: null, | |||
| id: this.internalMeetings[i].id, | |||
| meeting: this.internalMeetings[i], | |||
| title: this.internalMeetings[i].title, | |||
| id: item.id, | |||
| meeting: item, | |||
| title: item.title, | |||
| objectName: 'PLP Intern', | |||
| dateStart: this.internalMeetings[i].start_date, | |||
| dateEnd: this.internalMeetings[i].end_date, | |||
| dateStart: item.start_date, | |||
| dateEnd: item.end_date, | |||
| type: 'Intern', | |||
| typeType: '', | |||
| reportExists: this.internalMeetings[i].report !== null ? 'Ja' : 'Nein', | |||
| reportExists: item.report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: '-', | |||
| street: '', | |||
| street_no: '', | |||
| @@ -180,126 +153,19 @@ export class MeetingListComponent extends AgGridComponent implements OnInit, OnD | |||
| owner: owner.firstname + ' ' + owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| contactName: null, | |||
| participants: this.internalMeetings[i].v_participants, | |||
| participants: item.v_participants, | |||
| department: null, | |||
| email: null, | |||
| phone: null, | |||
| mobile: null, | |||
| }); | |||
| } | |||
| for (let o = 0; o < this.operatorMeetings.length; o++) { | |||
| owner = this.appService.getConfig().vc_user_by_id[this.operatorMeetings[o].owner_user_id]; | |||
| meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.operatorMeetings[o].meeting_type_id]; | |||
| let operatorContactName: string = null !== this.operatorMeetings[o].firstname ? this.operatorMeetings[o].firstname + ' ' : ''; | |||
| operatorContactName += null !== this.operatorMeetings[o].lastname ? this.operatorMeetings[o].lastname : ''; | |||
| const operator: IOperator = this.operatorsById[this.operatorMeetings[o].operator_id]; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.operatorMeetings[o].creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| itemType: 'operator', | |||
| objectId: operator.id, | |||
| id: this.operatorMeetings[o].id, | |||
| meeting: this.operatorMeetings[o], | |||
| title: this.operatorMeetings[o].title, | |||
| objectName: operator.name, | |||
| dateStart: this.operatorMeetings[o].start_date, | |||
| dateEnd: this.operatorMeetings[o].end_date, | |||
| type: meetingType.name, | |||
| typeType: meetingType.type, | |||
| reportExists: this.operatorMeetings[o].report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: '-', | |||
| street: this.operatorMeetings[o].street, | |||
| street_no: this.operatorMeetings[o].street_no, | |||
| zip: this.operatorMeetings[o].zip, | |||
| city: this.operatorMeetings[o].city, | |||
| owner: owner.firstname + ' ' + owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| contactName: operatorContactName, | |||
| participants: this.operatorMeetings[o].v_participants, | |||
| department: this.operatorMeetings[o].department, | |||
| email: this.operatorMeetings[o].email, | |||
| phone: this.operatorMeetings[o].phone_no, | |||
| mobile: this.operatorMeetings[o].mobile_no, | |||
| }); | |||
| } | |||
| for (let p = 0; p < this.productionMeetings.length; p++) { | |||
| owner = this.appService.getConfig().vc_user_by_id[this.productionMeetings[p].owner_user_id]; | |||
| meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.productionMeetings[p].meeting_type_id]; | |||
| let contactName: string = null !== this.productionMeetings[p].firstname ? this.productionMeetings[p].firstname + ' ' : ''; | |||
| contactName += null !== this.productionMeetings[p].lastname ? this.productionMeetings[p].lastname : ''; | |||
| const production: IProduction = this.operatorsById[this.productionMeetings[p].production_id]; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.productionMeetings[p].creation_user_id]; | |||
| }); | |||
| items.push({ | |||
| that: this, | |||
| itemType: 'production', | |||
| objectId: production.id, | |||
| id: this.productionMeetings[p].id, | |||
| meeting: this.productionMeetings[p], | |||
| title: this.productionMeetings[p].title, | |||
| objectName: production.name, | |||
| dateStart: this.productionMeetings[p].start_date, | |||
| dateEnd: this.productionMeetings[p].end_date, | |||
| type: meetingType.name, | |||
| typeType: meetingType.type, | |||
| reportExists: this.productionMeetings[p].report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: '-', | |||
| street: this.productionMeetings[p].street, | |||
| street_no: this.productionMeetings[p].street_no, | |||
| zip: this.productionMeetings[p].zip, | |||
| city: this.productionMeetings[p].city, | |||
| owner: owner.firstname + ' ' + owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| contactName, | |||
| participants: this.productionMeetings[p].v_participants, | |||
| department: this.productionMeetings[p].department, | |||
| email: this.productionMeetings[p].email, | |||
| phone: this.productionMeetings[p].phone_no, | |||
| mobile: this.productionMeetings[p].mobile_no, | |||
| }); | |||
| } | |||
| for (let s = 0; s < this.serviceMeetings.length; s++) { | |||
| owner = this.appService.getConfig().vc_user_by_id[this.serviceMeetings[s].owner_user_id]; | |||
| meetingType = this.appService.getConfig().vc_meeting_types_by_id[this.serviceMeetings[s].meeting_type_id]; | |||
| let contactName: string = null !== this.serviceMeetings[s].firstname ? this.serviceMeetings[s].firstname + ' ' : ''; | |||
| contactName += null !== this.serviceMeetings[s].lastname ? this.serviceMeetings[s].lastname : ''; | |||
| const service: IService = this.operatorsById[this.serviceMeetings[s].service_id]; | |||
| const creator: IUser = this.appService.getConfig().vc_user_by_id[this.serviceMeetings[s].creation_user_id]; | |||
| items.push({ | |||
| that: this, | |||
| itemType: 'service', | |||
| objectId: service.id, | |||
| id: this.serviceMeetings[s].id, | |||
| meeting: this.serviceMeetings[s], | |||
| title: this.serviceMeetings[s].title, | |||
| objectName: service.name, | |||
| dateStart: this.serviceMeetings[s].start_date, | |||
| dateEnd: this.serviceMeetings[s].end_date, | |||
| type: meetingType.name, | |||
| typeType: meetingType.type, | |||
| reportExists: this.serviceMeetings[s].report !== null ? 'Ja' : 'Nein', | |||
| is_option_meeting: '-', | |||
| street: this.serviceMeetings[s].street, | |||
| street_no: this.serviceMeetings[s].street_no, | |||
| zip: this.serviceMeetings[s].zip, | |||
| city: this.serviceMeetings[s].city, | |||
| owner: owner.firstname + ' ' + owner.lastname, | |||
| creator: creator.firstname + ' ' + creator.lastname, | |||
| contactName, | |||
| participants: this.serviceMeetings[s].v_participants, | |||
| department: this.serviceMeetings[s].department, | |||
| email: this.serviceMeetings[s].email, | |||
| phone: this.serviceMeetings[s].phone_no, | |||
| mobile: this.serviceMeetings[s].mobile_no, | |||
| }); | |||
| } | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a.dateStart, b.dateStart, false)); | |||
| this.rowData = items.sort((a: {} , b: {}) => this.dateComparator(a['dateStart'], b['dateStart'], false)); | |||
| } | |||
| /** | |||
| * row is clicked | |||
| * @param e | |||
| */ | |||
| public rowClicked(e: any): void { | |||
| switch (e.data.itemType) { | |||
| @@ -309,25 +175,16 @@ export class MeetingListComponent extends AgGridComponent implements OnInit, OnD | |||
| case 'internal': | |||
| this.editInternalMeeting.emit(e.data.meeting); | |||
| break; | |||
| case 'operator': | |||
| this.editOperatorMeeting.emit(e.data.meeting); | |||
| break; | |||
| case 'production': | |||
| this.editProductionMeeting.emit(e.data.meeting); | |||
| break; | |||
| case 'service': | |||
| this.editServiceMeeting.emit(e.data.meeting); | |||
| break; | |||
| } | |||
| } | |||
| public exportFilteredMeetingList(e: any): void { | |||
| const exportData: {}[] = []; | |||
| this.gridParamsApi.forEachNodeAfterFilter(function(rowNode, index) { | |||
| this.gridParamsApi.forEachNodeAfterFilter((rowNode, index) => { | |||
| const exportEntry: {} = rowNode.data; | |||
| delete exportEntry.that; | |||
| delete exportEntry.participants; | |||
| delete exportEntry['that']; | |||
| delete exportEntry['participants']; | |||
| exportData.push(exportEntry); | |||
| }); | |||
| @@ -6,68 +6,38 @@ | |||
| <app-tab tabTitle="Termin-Kalender" [tabIndex]="0"> | |||
| <app-meeting-calendar #meetingCalendar | |||
| (editCustomerMeeting)="rowClickedCustomerMeeting($event)" | |||
| (editOperatorMeeting)="rowClickedOperatorMeeting($event)" | |||
| (editInternalMeeting)="rowClickedInternalMeeting($event)" | |||
| (editProductionMeeting)="rowClickedProductionMeeting($event)" | |||
| (editServiceMeeting)="rowClickedServiceMeeting($event)"> | |||
| (editInternalMeeting)="rowClickedInternalMeeting($event)"> | |||
| </app-meeting-calendar> | |||
| </app-tab> | |||
| <app-tab tabTitle="Termin-Liste" [tabIndex]="1"> | |||
| <app-meeting-list #meetingList | |||
| (editCustomerMeeting)="rowClickedCustomerMeeting($event)" | |||
| (editOperatorMeeting)="rowClickedOperatorMeeting($event)" | |||
| (editInternalMeeting)="rowClickedInternalMeeting($event)" | |||
| (editProductionMeeting)="rowClickedProductionMeeting($event)" | |||
| (editServiceMeeting)="rowClickedServiceMeeting($event)"> | |||
| (editInternalMeeting)="rowClickedInternalMeeting($event)"> | |||
| </app-meeting-list> | |||
| </app-tab> | |||
| </app-tabs> | |||
| </div> | |||
| <app-modal [overlay]="true" #modalCustomerMeetingDetailStart> | |||
| <app-spt-modal [overlay]="true" #modalCustomerMeetingDetailStart> | |||
| <app-customer-meeting-detail #customerMeetingDetailStart | |||
| (editMeeting)="editCustomerMeetingFunction($event)" | |||
| (deleteMeeting)="deleteCustomerMeetingFunction($event)" | |||
| (editMeetingReport)="editCustomerMeetingReportFunction($event)"> | |||
| </app-customer-meeting-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| <app-modal [overlay]="true" #modalOperatorMeetingDetailStart> | |||
| <app-operator-meeting-detail #operatorMeetingDetailStart | |||
| (editMeeting)="editOperatorMeetingFunction($event)" | |||
| (deleteMeeting)="deleteOperatorMeetingFunction($event)" | |||
| (editMeetingReport)="editOperatorMeetingReportFunction($event)"> | |||
| </app-operator-meeting-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalInternalMeetingDetailStart> | |||
| <app-spt-modal [overlay]="true" #modalInternalMeetingDetailStart> | |||
| <app-internal-meeting-detail #internalMeetingDetailStart | |||
| (editMeeting)="editInternalMeetingFunction($event)" | |||
| (deleteMeeting)="deleteInternalMeetingFunction($event)" | |||
| (editMeetingReport)="editInternalMeetingReportFunction($event)"> | |||
| </app-internal-meeting-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalProductionMeetingDetailStart> | |||
| <app-production-meeting-detail #productionMeetingDetailStart | |||
| (editMeeting)="editProductionMeetingFunction($event)" | |||
| (deleteMeeting)="deleteProductionMeetingFunction($event)" | |||
| (editMeetingReport)="editProductionMeetingReportFunction($event)"> | |||
| </app-production-meeting-detail> | |||
| </app-modal> | |||
| <app-modal [overlay]="true" #modalServiceMeetingDetailStart> | |||
| <app-service-meeting-detail #serviceMeetingDetailStart | |||
| (editMeeting)="editServiceMeetingFunction($event)" | |||
| (deleteMeeting)="deleteServiceMeetingFunction($event)" | |||
| (editMeetingReport)="editServiceMeetingReportFunction($event)"> | |||
| </app-service-meeting-detail> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| <app-modal [overlay]="true" #modalInternalMeetingEdit> | |||
| <app-spt-modal [overlay]="true" #modalInternalMeetingEdit> | |||
| <div id="internal-meeting-modal"> | |||
| <app-internal-meeting-edit #internalMeetingEdit | |||
| (createMeeting)="createMeetingInternal($event)"> | |||
| </app-internal-meeting-edit> | |||
| </div> | |||
| </app-modal> | |||
| </app-spt-modal> | |||
| @@ -1,4 +1,4 @@ | |||
| import {Component, ChangeDetectionStrategy, ViewChild, OnInit, OnDestroy} from '@angular/core'; | |||
| import {Component, ChangeDetectionStrategy, ViewChild, OnInit, OnDestroy, NgModule} from '@angular/core'; | |||
| import {Subscription} from 'rxjs'; | |||
| import {AppService} from '../../services/app.service'; | |||
| import {CustomerService} from '../../services/customer.service'; | |||
| @@ -17,19 +17,7 @@ import {InternalMeetingEditComponent} from './internal-meeting-edit/internal-mee | |||
| import {Factory} from '../../factory/factory'; | |||
| import {InternalMeetingDetailComponent} from './internal-meeting-detail/internal-meeting-detail.component'; | |||
| import {IMeetingData} from '../../model/virtual/meeting-data'; | |||
| import {IOperatorMeeting} from '../../model/entities/operator-meeting'; | |||
| import {IOperator} from '../../model/entities/operator'; | |||
| import {OperatorMeetingDetailComponent} from '../operators/operator-view/operator-meeting-detail/operator-meeting-detail.component'; | |||
| import {IProduction} from '../../model/entities/production'; | |||
| import {IService} from '../../model/entities/service'; | |||
| import {IProductionMeeting} from '../../model/entities/production-meeting'; | |||
| import {IServiceMeeting} from '../../model/entities/service-meeting'; | |||
| import { | |||
| ProductionMeetingDetailComponent | |||
| } from '../productions/production-view/production-meeting-detail/production-meeting-detail.component'; | |||
| import { | |||
| ServiceMeetingDetailComponent | |||
| } from '../services/service-view/service-meeting-detail/service-meeting-detail.component'; | |||
| import {TabComponent} from '../../components/tab/tab.component'; | |||
| @Component({ | |||
| selector: 'app-start', | |||
| @@ -51,32 +39,15 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| @ViewChild('modalCustomerMeetingEditStart', {static: true}) modalCustomerMeetingEditStart: ModalComponent; | |||
| @ViewChild('customerMeetingDetailStart', {static: true}) customerMeetingDetailStart: CustomerMeetingDetailComponent; | |||
| @ViewChild('customerMeetingEditStart', {static: true}) customerMeetingEditStart: CustomerMeetingEditComponent; | |||
| @ViewChild('modalOperatorMeetingDetailStart', {static: true}) modalOperatorMeetingDetailStart: ModalComponent; | |||
| @ViewChild('operatorMeetingDetailStart', {static: true}) operatorMeetingDetailStart: OperatorMeetingDetailComponent; | |||
| @ViewChild('modalProductionMeetingDetailStart', {static: true}) modalProductionMeetingDetailStart: ModalComponent; | |||
| @ViewChild('productionMeetingDetailStart', {static: true}) productionMeetingDetailStart: ProductionMeetingDetailComponent; | |||
| @ViewChild('modalServiceMeetingDetailStart', {static: true}) modalServiceMeetingDetailStart: ModalComponent; | |||
| @ViewChild('serviceMeetingDetailStart', {static: true}) serviceMeetingDetailStart: ServiceMeetingDetailComponent; | |||
| private customers: ICustomer[]; | |||
| private customersById: {}; | |||
| private operators: IOperator[]; | |||
| private operatorsById: {}; | |||
| private productions: IProduction[]; | |||
| private productionsById: {}; | |||
| private services: IService[]; | |||
| private servicesById: {}; | |||
| private customersSub: Subscription; | |||
| private operatorsSub: Subscription; | |||
| private productionsSub: Subscription; | |||
| private servicesSub: Subscription; | |||
| private meetingData: IMeetingData; | |||
| private meetingsSub: Subscription; | |||
| private customerMeetings: ICustomerMeeting[]; | |||
| private internalMeetings: IInternalMeeting[]; | |||
| private operatorMeetings: IOperatorMeeting[]; | |||
| private productionMeetings: IProductionMeeting[]; | |||
| private serviceMeetings: IServiceMeeting[]; | |||
| constructor( | |||
| private appService: AppService, | |||
| @@ -88,13 +59,9 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| ngOnInit() { | |||
| this.customers = null; | |||
| this.customersById = {}; | |||
| this.operators = null; | |||
| this.operatorsById = {}; | |||
| this.customerMeetings = null; | |||
| this.internalMeetings = null; | |||
| this.operatorMeetings = null; | |||
| this.productionMeetings = null; | |||
| this.serviceMeetings = null; | |||
| this.customerService.apiGetCustomerData(); | |||
| this.meetingService.apiGetMeetingData(); | |||
| @@ -113,15 +80,9 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| if (null !== data) { | |||
| this.customerMeetings = data.customerMeetings; | |||
| this.internalMeetings = data.internalMeetings; | |||
| this.operatorMeetings = data.operatorMeetings; | |||
| this.productionMeetings = data.productionMeetings; | |||
| this.serviceMeetings = data.serviceMeetings; | |||
| } else { | |||
| this.customerMeetings = null; | |||
| this.internalMeetings = null; | |||
| this.operatorMeetings = null; | |||
| this.productionMeetings = null; | |||
| this.serviceMeetings = null; | |||
| } | |||
| this.setComponentData(); | |||
| } | |||
| @@ -133,36 +94,17 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| */ | |||
| private setComponentData() { | |||
| if (null !== this.customers && | |||
| null !== this.operators && | |||
| null !== this.productions && | |||
| null !== this.services && | |||
| null !== this.customerMeetings && | |||
| null !== this.internalMeetings && | |||
| null !== this.operatorMeetings && | |||
| null !== this.productionMeetings && | |||
| null !== this.serviceMeetings | |||
| ) { | |||
| null !== this.internalMeetings) { | |||
| this.meetingCalendar.setData( | |||
| this.customersById, | |||
| this.operatorsById, | |||
| this.productionsById, | |||
| this.servicesById, | |||
| this.customerMeetings, | |||
| this.internalMeetings, | |||
| this.operatorMeetings, | |||
| this.productionMeetings, | |||
| this.serviceMeetings | |||
| ); | |||
| this.meetingList.setData( | |||
| this.customersById, | |||
| this.operatorsById, | |||
| this.productionsById, | |||
| this.servicesById, | |||
| this.customerMeetings, | |||
| this.internalMeetings, | |||
| this.operatorMeetings, | |||
| this.productionMeetings, | |||
| this.serviceMeetings | |||
| ); | |||
| } | |||
| } | |||
| @@ -172,26 +114,11 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| this.customerMeetingDetailStart.setData(this.customersById[e.customer_id], e); | |||
| } | |||
| public rowClickedOperatorMeeting(e: IOperatorMeeting): void { | |||
| this.modalOperatorMeetingDetailStart.openModal(); | |||
| this.operatorMeetingDetailStart.setData(this.operatorsById[e.operator_id], e); | |||
| } | |||
| public rowClickedInternalMeeting(e: IInternalMeeting): void { | |||
| this.modalInternalMeetingDetailStart.openModal(); | |||
| this.internalMeetingDetailStart.setData(e); | |||
| } | |||
| public rowClickedProductionMeeting(e: IProductionMeeting): void { | |||
| this.modalProductionMeetingDetailStart.openModal(); | |||
| this.productionMeetingDetailStart.setData(this.productionsById[e.production_id], e); | |||
| } | |||
| public rowClickedServiceMeeting(e: IServiceMeeting): void { | |||
| this.modalServiceMeetingDetailStart.openModal(); | |||
| this.serviceMeetingDetailStart.setData(this.servicesById[e.service_id], e); | |||
| } | |||
| public editCustomerMeetingFunction(customerMeeting: ICustomerMeeting): void { | |||
| this.meetingService.apiEditCustomerMeeting(customerMeeting).subscribe( | |||
| data => { | |||
| @@ -223,37 +150,6 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| ); | |||
| } | |||
| public editOperatorMeetingFunction(operatorMeeting: IOperatorMeeting): void { | |||
| this.meetingService.apiEditOperatorMeeting(operatorMeeting).subscribe( | |||
| data => { | |||
| this.operatorMeetingDetailStart.updateData(data.result_data as IOperator); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| public editOperatorMeetingReportFunction(reportValues: any): void { | |||
| const meetingId: number = reportValues.id; | |||
| const report: string = reportValues.report; | |||
| this.meetingService.apiEditOperatorMeetingReport(meetingId, report).subscribe( | |||
| data => { | |||
| this.operatorMeetingDetailStart.updateData(data.result_data as IOperator); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| public deleteOperatorMeetingFunction(operatorMeetingId: number): void { | |||
| this.meetingService.apiDeleteOperatorMeeting(operatorMeetingId).subscribe( | |||
| data => { | |||
| this.modalOperatorMeetingDetailStart.exitModal(); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| public editInternalMeetingFunction(internalMeeting: IInternalMeeting): void { | |||
| this.meetingService.apiEditInternalMeeting(internalMeeting).subscribe( | |||
| data => { | |||
| @@ -299,68 +195,6 @@ export class StartComponent implements OnInit, OnDestroy { | |||
| ); | |||
| } | |||
| public editProductionMeetingFunction(productionMeeting: IProductionMeeting): void { | |||
| this.meetingService.apiEditProductionMeeting(productionMeeting).subscribe( | |||
| data => { | |||
| this.productionMeetingDetailStart.updateData(data.result_data as IProduction); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| public editProductionMeetingReportFunction(reportValues: any): void { | |||
| const meetingId: number = reportValues.id; | |||
| const report: string = reportValues.report; | |||
| this.meetingService.apiEditProductionMeetingReport(meetingId, report).subscribe( | |||
| data => { | |||
| this.productionMeetingDetailStart.updateData(data.result_data as IProduction); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| public deleteProductionMeetingFunction(productionMeetingId: number): void { | |||
| this.meetingService.apiDeleteProductionMeeting(productionMeetingId).subscribe( | |||
| data => { | |||
| this.modalProductionMeetingDetailStart.exitModal(); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| public editServiceMeetingFunction(serviceMeeting: IServiceMeeting): void { | |||
| this.meetingService.apiEditServiceMeeting(serviceMeeting).subscribe( | |||
| data => { | |||
| this.serviceMeetingDetailStart.updateData(data.result_data as IService); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| public editServiceMeetingReportFunction(reportValues: any): void { | |||
| const meetingId: number = reportValues.id; | |||
| const report: string = reportValues.report; | |||
| this.meetingService.apiEditServiceMeetingReport(meetingId, report).subscribe( | |||
| data => { | |||
| this.serviceMeetingDetailStart.updateData(data.result_data as IService); | |||
| }, | |||
| error => {} | |||
| ); | |||
| } | |||
| public deleteServiceMeetingFunction(serviceMeetingId: number): void { | |||
| this.meetingService.apiDeleteServiceMeeting(serviceMeetingId).subscribe( | |||
| data => { | |||
| this.modalServiceMeetingDetailStart.exitModal(); | |||
| }, | |||
| error => { | |||
| } | |||
| ); | |||
| } | |||
| /** | |||
| * Destroy | |||
| */ | |||
| @@ -13,9 +13,9 @@ | |||
| @import "components/tabs"; | |||
| /* angular-cli file: src/styles.css */ | |||
| @import "~angular-calendar/css/angular-calendar.css"; | |||
| @import "~ag-grid-community/dist/styles/ag-grid.css"; | |||
| @import "~ag-grid-community/dist/styles/ag-theme-balham.css"; | |||
| /*@import "~angular-calendar/css/angular-calendar.css";*/ | |||
| @import "~ag-grid-community/styles/ag-grid.css"; | |||
| @import "~ag-grid-community/styles/ag-theme-balham.css"; | |||
| /* apply a natural box layout model to all elements, but allowing person to change */ | |||
| html {box-sizing:border-box;} | |||
| @@ -2,7 +2,7 @@ | |||
| "extends": "./tsconfig.json", | |||
| "compilerOptions": { | |||
| "outDir": "./out-tsc/app", | |||
| "types": [] | |||
| "types": ["node"] | |||
| }, | |||
| "files": [ | |||
| "src/main.ts", | |||
| @@ -16,6 +16,6 @@ | |||
| "src/**/*.spec.ts" | |||
| ], | |||
| "types": [ | |||
| "node" | |||
| ] | |||
| } | |||