| @@ -0,0 +1,103 @@ | |||||
| #!/bin/bash | |||||
| #export PATH=/opt/plesk/php/7.2/bin:$PATH; | |||||
| # Go into Maintenance Mode | |||||
| #cp -rf /var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/src/maintenance/index.php #/var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/ | |||||
| #mv /var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/index.html #/var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/_index.html | |||||
| #echo "$(tput setab 1)too1s is now in MAINTENANCE MODE!$(tput sgr 0)" | |||||
| # Check out beta | |||||
| echo "$(tput setab 2)CRM backend will now be PULLED on LIVE$(tput sgr 0)" | |||||
| cd /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs | |||||
| git pull | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/composer.json | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/composer.json /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/composer.lock | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/composer.lock /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/symfony.lock | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/symfony.lock /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/updateDb.php | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/updateDb.php /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/assets/ | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/assets /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/import/ | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/import /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/public/ | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/public /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/src/ | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/src /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/templates/ | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/templates /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/services.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/services.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/doctrine.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/packages/doctrine.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/framework.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/packages/framework.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/nelmio_cors.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/packages/nelmio_cors.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/security.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/packages/security.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/ | |||||
| rm -rf /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/swiftmailer.yaml | |||||
| cp -rf /var/www/vhosts/plp-tool.de/httpdocs/git_repository/spt-plp-tool-gamma/httpdocs/symfony/config/packages/swiftmailer.yaml /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/config/packages/ | |||||
| cd /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony | |||||
| #php /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/bin/console doctrine:schema:update --force | |||||
| composer update | |||||
| php updateDb.php | |||||
| echo "$(tput setab 2)DATABASE SCHEMA updated$(tput sgr 0)" | |||||
| php /var/www/vhosts/plp-tool.de/httpdocs/plp-tool-live/symfony/bin/console cache:clear --env=prod --no-debug --no-warmup | |||||
| echo "$(tput setab 2)CACHE cleared$(tput sgr 0)" | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/e2e/ | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/src/ | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/.htaccess | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/.htpasswd | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/README.md | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/angular.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/browserslist | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/karma.conf.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/package.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/package-lock.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/tsconfig.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/tsconfig.app.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/tsconfig.spec.json | |||||
| rm -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/tslint.json | |||||
| cp -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/git_repo/spt-crm-frontend/httpdocs/* /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/ | |||||
| echo "$(tput setab 2)Files have been copied to ANGULAR LIVE$(tput sgr 0)" | |||||
| cd /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/ | |||||
| ng build --configuration=gamma --prod --aot | |||||
| cp -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/git_repo/spt-crm-frontend/httpdocs/.htaccess /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/dist/ | |||||
| cp -rf /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/git_repo/spt-crm-frontend/httpdocs/.htpasswd /var/www/vhosts/spawntree.de/crm.spawntree.de/httpdocs/dist/ | |||||
| echo "$(tput setab 2)ANGULAR APP built on LIVE$(tput sgr 0)" | |||||
| # Remove Maintenance Mode | |||||
| # Angular App will publish all data in /dist/ folder so maintenance data does not have to be removed. | |||||
| #mv /var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/_index.html #/var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/index.html | |||||
| #rm /var/www/vhosts/h2790573.stratoserver.net/beta-too1s.h2790573.stratoserver.net/dist/index.php | |||||
| echo "$(tput setab 2)PLP TOOL is now LIVE!$(tput sgr 0)" | |||||
| @@ -62,7 +62,7 @@ | |||||
| ], | ], | ||||
| "optimization": true, | "optimization": true, | ||||
| "outputHashing": "all", | "outputHashing": "all", | ||||
| "sourceMap": false, | |||||
| "sourceMap": true, | |||||
| "extractCss": true, | "extractCss": true, | ||||
| "namedChunks": false, | "namedChunks": false, | ||||
| "aot": true, | "aot": true, | ||||
| @@ -4,9 +4,6 @@ import { StartComponent } from './views/start/start.component'; | |||||
| import {CustomerManagementComponent} from './views/customer-management/customer-management.component'; | import {CustomerManagementComponent} from './views/customer-management/customer-management.component'; | ||||
| import {LoginComponent} from './views/login/login.component'; | import {LoginComponent} from './views/login/login.component'; | ||||
| import {RouteInterceptor} from './interceptor/route-interceptor'; | 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'; | |||||
| const routes: Routes = [ | const routes: Routes = [ | ||||
| @@ -33,7 +30,4 @@ export const routingComponents = [ | |||||
| LoginComponent, | LoginComponent, | ||||
| StartComponent, | StartComponent, | ||||
| CustomerManagementComponent, | CustomerManagementComponent, | ||||
| AccountingComponent, | |||||
| TechniqueComponent, | |||||
| SalesComponent, | |||||
| ]; | ]; | ||||
| @@ -25,6 +25,7 @@ export class AppComponent implements OnInit, OnDestroy { | |||||
| // Observe login state | // Observe login state | ||||
| this.loginSub = this.appService.getLoginState$().subscribe( | this.loginSub = this.appService.getLoginState$().subscribe( | ||||
| data => { | data => { | ||||
| console.log(data); | |||||
| if (data !== null) { | if (data !== null) { | ||||
| this.isLoggedIn = true; | this.isLoggedIn = true; | ||||
| } else { | } else { | ||||
| @@ -21,7 +21,7 @@ import {CacheService} from './services/cache.service'; | |||||
| import {MessageService} from './services/message.service'; | import {MessageService} from './services/message.service'; | ||||
| import {HttpService} from './services/http.service'; | import {HttpService} from './services/http.service'; | ||||
| import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; | import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; | ||||
| import {HttpClientInterceptor} from './services/http.interceptor'; | |||||
| import {RouteInterceptor} from './interceptor/route-interceptor'; | import {RouteInterceptor} from './interceptor/route-interceptor'; | ||||
| import { TechniqueComponent } from './views/technique/technique.component'; | import { TechniqueComponent } from './views/technique/technique.component'; | ||||
| import { SalesComponent } from './views/sales/sales.component'; | import { SalesComponent } from './views/sales/sales.component'; | ||||
| @@ -65,6 +65,7 @@ import { CalendarLegendComponent } from './components/calendar-legend/calendar-l | |||||
| import { CommonService } from './services/common.service'; | import { CommonService } from './services/common.service'; | ||||
| import {GridRendererComponent} from './grid-cellrenderer/grid-renderer-component'; | import {GridRendererComponent} from './grid-cellrenderer/grid-renderer-component'; | ||||
| import {GridEditorComponent} from './grid-cellrenderer/grid-editor-component'; | import {GridEditorComponent} from './grid-cellrenderer/grid-editor-component'; | ||||
| import {HttpClientInterceptor} from "./interceptor/http.interceptor"; | |||||
| registerLocaleData(localeDe); | registerLocaleData(localeDe); | ||||
| @@ -1,6 +1,6 @@ | |||||
| <div class="home-btn" routerLink="/start"> | |||||
| Startseite | |||||
| </div> | |||||
| <!--<div class="home-btn" routerLink="/start">--> | |||||
| <!-- Startseite--> | |||||
| <!--</div>--> | |||||
| <ul id="navigation"> | <ul id="navigation"> | ||||
| <li *ngFor="let navItem of navItems" routerLink="{{navItem.route}}"> | <li *ngFor="let navItem of navItems" routerLink="{{navItem.route}}"> | ||||
| <p>{{navItem.name}}</p> | <p>{{navItem.name}}</p> | ||||
| @@ -16,15 +16,8 @@ export class AsideComponent implements OnInit { | |||||
| ngOnInit() { | ngOnInit() { | ||||
| this.navItems = []; | this.navItems = []; | ||||
| this.navItems.push({name: 'Start', route: '/start', className: 'start'}); | |||||
| this.navItems.push({name: 'Kunden', route: '/customer-management', className: 'customer-management'}); | this.navItems.push({name: 'Kunden', route: '/customer-management', className: 'customer-management'}); | ||||
| this.navItems.push({name: 'Betreiber', route: '/operators', className: 'operators'}); | |||||
| this.navItems.push({name: 'Produzenten', route: '/productions', className: 'productions'}); | |||||
| this.navItems.push({name: 'Service', route: '/service', className: 'service'}); | |||||
| // this.navItems.push({name: 'Buchhaltung', route: '/accounting', className: 'accounting'}); | |||||
| // this.navItems.push({name: 'Produktion', route: '/production', className: 'production'}); | |||||
| // this.navItems.push({name: 'Service', route: '/service', className: 'service'}); | |||||
| // this.navItems.push({name: 'Technik', route: '/technique', className: 'technique'}); | |||||
| // this.navItems.push({name: 'Vertrieb', route: '/sales', className: 'sales'}); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -25,10 +25,13 @@ export class RouteInterceptor { | |||||
| * @returns {boolean} | * @returns {boolean} | ||||
| */ | */ | ||||
| canActivate(): boolean { | canActivate(): boolean { | ||||
| if (this.loginState == null || !this.loginState.isLoggedIn) { | |||||
| console.log(this.loginState); | |||||
| if (this.loginState === null || !this.loginState.isLoggedIn) { | |||||
| this.router.navigate(['./login']); | this.router.navigate(['./login']); | ||||
| console.log('no routing'); | |||||
| return false; | return false; | ||||
| } | } | ||||
| console.log('routing works'); | |||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| @@ -3,5 +3,4 @@ import {EntityInterface} from '../interface/entity-interface'; | |||||
| export interface IUserType extends EntityInterface { | export interface IUserType extends EntityInterface { | ||||
| user_type_id: number; | user_type_id: number; | ||||
| type: string; | type: string; | ||||
| v_roles: string[]; | |||||
| } | } | ||||
| @@ -7,6 +7,6 @@ export interface IUser extends EntityInterface { | |||||
| lastname: string; | lastname: string; | ||||
| active: boolean; | active: boolean; | ||||
| visible: boolean; | visible: boolean; | ||||
| roles: string[]; | |||||
| v_translated_role: string; | v_translated_role: string; | ||||
| v_user_type: IUserType; | |||||
| } | } | ||||
| @@ -65,7 +65,7 @@ export class AppService { | |||||
| * @returns {boolean} | * @returns {boolean} | ||||
| */ | */ | ||||
| public userHasRole(role: string): boolean { | public userHasRole(role: string): boolean { | ||||
| return this.getAppUser().v_user_type.v_roles.indexOf(role) > -1; | |||||
| return this.getAppUser().roles.indexOf(role) > -1; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -89,11 +89,15 @@ export class AppService { | |||||
| this.httpService.apiPost('login', postData).subscribe( | this.httpService.apiPost('login', postData).subscribe( | ||||
| data => { | data => { | ||||
| const result: ILoginState = data as ILoginState; | const result: ILoginState = data as ILoginState; | ||||
| result.isLoggedIn = true; | |||||
| this.cacheService.setItem('loginState', result); | this.cacheService.setItem('loginState', result); | ||||
| this.cacheService.setItem('user', result.user); | this.cacheService.setItem('user', result.user); | ||||
| this.loginState.next(data); | this.loginState.next(data); | ||||
| this.user.next(data.user); | this.user.next(data.user); | ||||
| this.setConfig(data.config); | this.setConfig(data.config); | ||||
| }, | |||||
| error => { | |||||
| } | } | ||||
| ); | ); | ||||
| } | } | ||||
| @@ -24,7 +24,7 @@ export class HttpService { | |||||
| } | } | ||||
| private static AUTHENTICATION_ERROR_CODE = 401; | private static AUTHENTICATION_ERROR_CODE = 401; | ||||
| private static AUTHENTICATION_ERROR_MESSAGE = 'Sie sind nicht mehr im System eingeloggt. Bitte loggen Sie sich erneut ein.'; | |||||
| private static AUTHENTICATION_ERROR_MESSAGE = 'Sie sind nicht mehr im System eingeloggt bzw. ihre Login-Daten sind falsch. Bitte loggen Sie sich erneut ein.'; | |||||
| private renderer: Renderer2; | private renderer: Renderer2; | ||||
| private dataServiceData$: Observable<IAppServiceData>; | private dataServiceData$: Observable<IAppServiceData>; | ||||
| @@ -1,11 +1,6 @@ | |||||
| export class Const { | export class Const { | ||||
| static readonly USER_ROLE_ADMIN: string = 'ROLE_ADMIN'; | static readonly USER_ROLE_ADMIN: string = 'ROLE_ADMIN'; | ||||
| static readonly USER_ROLE_USER: string = 'ROLE_USER'; | static readonly USER_ROLE_USER: string = 'ROLE_USER'; | ||||
| static readonly USER_ROLE_SALES: string = 'ROLE_SALES'; | |||||
| static readonly USER_ROLE_TECHNIQUE: string = 'ROLE_TECHNIQUE'; | |||||
| static readonly USER_ROLE_PRODUCTION: string = 'ROLE_PRODUCTION'; | |||||
| static readonly USER_ROLE_ACCOUNTING: string = 'ROLE_ACCOUNTING'; | |||||
| static readonly USER_ROLE_SERVICE: string = 'ROLE_SERVICE'; | |||||
| static readonly CSS_NO_EDIT: string = 'not-editable'; | static readonly CSS_NO_EDIT: string = 'not-editable'; | ||||
| @@ -1,5 +1,5 @@ | |||||
| <div class="button" id="export-customer-contacts" (click)="exportCustomerContactsPdf()" *ngIf="hasExportRights">Ansprechpartner exportieren</div> | <div class="button" id="export-customer-contacts" (click)="exportCustomerContactsPdf()" *ngIf="hasExportRights">Ansprechpartner exportieren</div> | ||||
| <div class="button" id="xmas-mail" (click)="exportXmasPdf()" *ngIf="hasAdminRights">Weihnachtspost-Etiketten</div> | |||||
| <div class="button" id="xmas-mail" (click)="exportXmasPdf()" *ngIf="hasRights">Weihnachtspost-Etiketten</div> | |||||
| <form class="searchForm"> | <form class="searchForm"> | ||||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | ||||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | ||||
| @@ -27,7 +27,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||||
| public customersById: {}; | public customersById: {}; | ||||
| private customerContacts: ICustomerContact[]; | private customerContacts: ICustomerContact[]; | ||||
| public customerContactsById: {}; | public customerContactsById: {}; | ||||
| public hasAdminRights: boolean; | |||||
| public hasRights: boolean; | |||||
| public hasExportRights: boolean; | public hasExportRights: boolean; | ||||
| constructor(private customerService: CustomerService, private appService: AppService, private commonService: CommonService) { | constructor(private customerService: CustomerService, private appService: AppService, private commonService: CommonService) { | ||||
| @@ -35,7 +35,7 @@ export class CustomerContactListComponent extends AgGridComponent implements OnI | |||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasAdminRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.hasExportRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | this.hasExportRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | ||||
| this.customers = []; | this.customers = []; | ||||
| this.customersById = {}; | this.customersById = {}; | ||||
| @@ -1,4 +1,4 @@ | |||||
| <div class="button" id="create-customer" (click)="createCustomer()" *ngIf="hasSalesRights">Kunden anlegen</div> | |||||
| <div class="button" id="create-customer" (click)="createCustomer()" *ngIf="hasRights">Kunden anlegen</div> | |||||
| <form class="searchForm"> | <form class="searchForm"> | ||||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Kunden suchen" /> | <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Kunden suchen" /> | ||||
| @@ -17,7 +17,7 @@ export class CustomerListComponent extends AgGridComponent implements OnInit { | |||||
| private customers: ICustomer[]; | private customers: ICustomer[]; | ||||
| public rowClassRules: {}; | public rowClassRules: {}; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| public usersById: {}; | public usersById: {}; | ||||
| constructor(public appService: AppService) { | constructor(public appService: AppService) { | ||||
| @@ -26,7 +26,7 @@ export class CustomerListComponent extends AgGridComponent implements OnInit { | |||||
| ngOnInit() { | ngOnInit() { | ||||
| this.usersById = this.appService.getConfig().vc_user_by_id; | this.usersById = this.appService.getConfig().vc_user_by_id; | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.customers = []; | this.customers = []; | ||||
| this.defaultColDef = { | this.defaultColDef = { | ||||
| @@ -33,7 +33,7 @@ | |||||
| </dl> | </dl> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="form" *ngIf="hasSalesRights"> | |||||
| <div class="form" *ngIf="hasRights"> | |||||
| <div class="row row--last"> | <div class="row row--last"> | ||||
| <div class="column button-row"> | <div class="column button-row"> | ||||
| <span class="button-row--link" (click)="customerShortcut()">Zum Kundenprofil</span> | <span class="button-row--link" (click)="customerShortcut()">Zum Kundenprofil</span> | ||||
| @@ -25,12 +25,12 @@ export class CustomerContactPersonDetailComponent implements OnInit { | |||||
| public customer: ICustomer; | public customer: ICustomer; | ||||
| public customerContact: ICustomerContact; | public customerContact: ICustomerContact; | ||||
| public config: IConfig; | public config: IConfig; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| constructor(public appService: AppService) { } | constructor(public appService: AppService) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.config = this.appService.getConfig(); | this.config = this.appService.getConfig(); | ||||
| this.isEditMode = false; | this.isEditMode = false; | ||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| @@ -1,6 +1,6 @@ | |||||
| <h3>Ansprechpartner</h3> | <h3>Ansprechpartner</h3> | ||||
| <p>Hier sind die Ansprechpartner zu sehen:</p> | <p>Hier sind die Ansprechpartner zu sehen:</p> | ||||
| <div class="button" id="create-customer-contact" (click)="create()" *ngIf="hasSalesRights">Ansprechpartner anlegen</div> | |||||
| <div class="button" id="create-customer-contact" (click)="create()" *ngIf="hasRights">Ansprechpartner anlegen</div> | |||||
| <form class="searchForm"> | <form class="searchForm"> | ||||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Ansprechpartner suchen" /> | ||||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | ||||
| @@ -32,14 +32,14 @@ export class CustomerContactPersonViewComponent extends AgGridComponent implemen | |||||
| public customerContacts: ICustomerContact[]; | public customerContacts: ICustomerContact[]; | ||||
| public customerContactsById: {}; | public customerContactsById: {}; | ||||
| public config: IConfig; | public config: IConfig; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| constructor(private appService: AppService) { | constructor(private appService: AppService) { | ||||
| super(); | super(); | ||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.config = this.appService.getConfig(); | this.config = this.appService.getConfig(); | ||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| this.customerContacts = []; | this.customerContacts = []; | ||||
| @@ -29,7 +29,7 @@ | |||||
| </dl> | </dl> | ||||
| </div> | </div> | ||||
| <div class="grid-item"> | <div class="grid-item"> | ||||
| <div class="button button--inline right" (click)="edit()" *ngIf="hasSalesRights">bearbeiten</div> | |||||
| <div class="button button--inline right" (click)="edit()" *ngIf="hasRights">bearbeiten</div> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -23,13 +23,13 @@ export class CustomerDataViewComponent implements OnInit { | |||||
| public customer: ICustomer; | public customer: ICustomer; | ||||
| public checkedUrl: string; | public checkedUrl: string; | ||||
| public config: IConfig; | public config: IConfig; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| public usersById: {}; | public usersById: {}; | ||||
| constructor(private appService: AppService) { } | constructor(private appService: AppService) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.config = this.appService.getConfig(); | this.config = this.appService.getConfig(); | ||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| this.checkedUrl = ''; | this.checkedUrl = ''; | ||||
| @@ -1,5 +1,5 @@ | |||||
| <h3>Termine</h3> | <h3>Termine</h3> | ||||
| <div class="button" id="create-meeting" (click)="create()" *ngIf="hasSalesRights">Termin hinzufügen</div> | |||||
| <div class="button" id="create-meeting" (click)="create()" *ngIf="hasRights">Termin hinzufügen</div> | |||||
| <form class="searchForm"> | <form class="searchForm"> | ||||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Termin suchen" /> | <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Termin suchen" /> | ||||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | ||||
| @@ -38,14 +38,14 @@ export class CustomerMeetingViewComponent extends AgGridComponent implements OnI | |||||
| public date: string; | public date: string; | ||||
| public timeStart: string; | public timeStart: string; | ||||
| public timeEnd: string; | public timeEnd: string; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| constructor(public appService: AppService) { | constructor(public appService: AppService) { | ||||
| super(); | super(); | ||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| this.customerMeeting = []; | this.customerMeeting = []; | ||||
| this.customerMeetingEntriesById = {}; | this.customerMeetingEntriesById = {}; | ||||
| @@ -29,7 +29,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="form"> | <div class="form"> | ||||
| <div class="row row--last" *ngIf="hasSalesRights && appService.getAppUser().id === customerNote.creation_user_id"> | |||||
| <div class="row row--last" *ngIf="hasRights && appService.getAppUser().id === customerNote.creation_user_id"> | |||||
| <div class="column"> | <div class="column"> | ||||
| <div class="button button--inline" (click)="editEntry()">Eintrag bearbeiten</div> | <div class="button button--inline" (click)="editEntry()">Eintrag bearbeiten</div> | ||||
| <div class="button button--inline" (click)="deleteEntry()">Eintrag löschen</div> | <div class="button button--inline" (click)="deleteEntry()">Eintrag löschen</div> | ||||
| @@ -24,12 +24,12 @@ export class CustomerNoteDetailComponent implements OnInit { | |||||
| public creationDate: string; | public creationDate: string; | ||||
| public isEditMode: boolean; | public isEditMode: boolean; | ||||
| public noteDate: string; | public noteDate: string; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| constructor(public appService: AppService) { } | constructor(public appService: AppService) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| this.customerNote = Factory.getEmptyCustomerNote(); | this.customerNote = Factory.getEmptyCustomerNote(); | ||||
| this.creationDate = ''; | this.creationDate = ''; | ||||
| @@ -1,5 +1,5 @@ | |||||
| <h3>Notizen</h3> | <h3>Notizen</h3> | ||||
| <div class="button" id="create-history" (click)="create()" *ngIf="hasSalesRights">Notiz hinzufügen</div> | |||||
| <div class="button" id="create-history" (click)="create()" *ngIf="hasRights">Notiz hinzufügen</div> | |||||
| <form class="searchForm"> | <form class="searchForm"> | ||||
| <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Notiz suchen" /> | <input type="text" name="search" class="search" (input)="searchFormSubmit($event)" placeholder="Notiz suchen" /> | ||||
| <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | <button class="resetSearch" [hidden]="!resetSearchBtn"></button> | ||||
| @@ -29,14 +29,14 @@ export class CustomerNoteViewComponent extends AgGridComponent implements OnInit | |||||
| public customer: ICustomer; | public customer: ICustomer; | ||||
| public customerNote: ICustomerNote[]; | public customerNote: ICustomerNote[]; | ||||
| public customerNoteEntriesById: {}; | public customerNoteEntriesById: {}; | ||||
| public hasSalesRights: boolean; | |||||
| public hasRights: boolean; | |||||
| constructor(public appService: AppService) { | constructor(public appService: AppService) { | ||||
| super(); | super(); | ||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.hasSalesRights = this.appService.userHasRole(Const.USER_ROLE_SALES); | |||||
| this.hasRights = this.appService.userHasRole(Const.USER_ROLE_ADMIN); | |||||
| this.customer = Factory.getEmptyCustomer(); | this.customer = Factory.getEmptyCustomer(); | ||||
| this.customerNote = []; | this.customerNote = []; | ||||
| this.customerNoteEntriesById = {}; | this.customerNoteEntriesById = {}; | ||||
| @@ -17,6 +17,9 @@ | |||||
| </p> | </p> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <p *ngIf="loginFailed" class="error-msg"> | |||||
| Fehler beim Login. | |||||
| </p> | |||||
| <div class="row"> | <div class="row"> | ||||
| <label for="email" [class.error]="email.invalid && email.touched && email?.errors?.required">E-Mail</label> | <label for="email" [class.error]="email.invalid && email.touched && email?.errors?.required">E-Mail</label> | ||||
| <input type="email" [class.error]="email.invalid && email.touched && email?.errors?.required" id="email" required name="email" placeholder="E-Mail" | <input type="email" [class.error]="email.invalid && email.touched && email?.errors?.required" id="email" required name="email" placeholder="E-Mail" | ||||
| @@ -14,10 +14,13 @@ import {Router} from '@angular/router'; | |||||
| export class LoginComponent implements OnInit { | export class LoginComponent implements OnInit { | ||||
| private loginSub: Subscription; | private loginSub: Subscription; | ||||
| public isLoggedIn: boolean; | |||||
| public loginFailed: boolean; | |||||
| public loginAttempt: boolean; | |||||
| public errorMsg: string; | public errorMsg: string; | ||||
| public loginForm: UntypedFormGroup; | public loginForm: UntypedFormGroup; | ||||
| /** | /** | ||||
| * Gets email | * Gets email | ||||
| */ | */ | ||||
| @@ -37,7 +40,8 @@ export class LoginComponent implements OnInit { | |||||
| } | } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.isLoggedIn = false; | |||||
| this.loginAttempt = false; | |||||
| this.loginFailed = false; | |||||
| this.loginForm = this.fb.group({ | this.loginForm = this.fb.group({ | ||||
| email: ['', [Validators.required, Validators.email]], | email: ['', [Validators.required, Validators.email]], | ||||
| password: [environment.password, [Validators.required, Validators.minLength(4)]] | password: [environment.password, [Validators.required, Validators.minLength(4)]] | ||||
| @@ -46,11 +50,13 @@ export class LoginComponent implements OnInit { | |||||
| // Observe login state | // Observe login state | ||||
| this.loginSub = this.appService.getLoginState$().subscribe( | this.loginSub = this.appService.getLoginState$().subscribe( | ||||
| data => { | data => { | ||||
| console.log(data); | |||||
| if (data !== null) { | if (data !== null) { | ||||
| this.isLoggedIn = true; | |||||
| this.router.navigate(['./start']); | this.router.navigate(['./start']); | ||||
| } else { | } else { | ||||
| this.isLoggedIn = false; | |||||
| if (this.loginAttempt) { | |||||
| this.loginFailed = true; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| ); | ); | ||||
| @@ -61,6 +67,7 @@ export class LoginComponent implements OnInit { | |||||
| */ | */ | ||||
| public onFormSubmit(): void { | public onFormSubmit(): void { | ||||
| if (this.loginForm.valid) { | if (this.loginForm.valid) { | ||||
| this.loginFailed = false; | |||||
| this.appService.login(this.email.value, this.password.value); | this.appService.login(this.email.value, this.password.value); | ||||
| } | } | ||||
| } | } | ||||
| @@ -69,7 +76,7 @@ export class LoginComponent implements OnInit { | |||||
| * Forgot password | * Forgot password | ||||
| */ | */ | ||||
| public forgotPassword(): void { | public forgotPassword(): void { | ||||
| alert('Hier folgt in Zukunft die Funktionalität \'Neues Passwort vergeben\'.\nBei Problemen wenden Sie sich bitte an admin@plp-tool.de.'); | |||||
| window.alert('-'); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| <h2>Termin-Kalender</h2> | <h2>Termin-Kalender</h2> | ||||
| <div class="form user-filter"> | <div class="form user-filter"> | ||||
| <div> | <div> | ||||
| <label for="mcCalendarUser"><strong>PLP Mitarbeiter</strong></label> | |||||
| <label for="mcCalendarUser"><strong>Mitarbeiter</strong></label> | |||||
| <select id="mcCalendarUser" name="mcCalendarUser" [(ngModel)]="selectedUserIndex" (change)="changeUserFilter($event)" #mcCalendarUser="ngModel"> | <select id="mcCalendarUser" name="mcCalendarUser" [(ngModel)]="selectedUserIndex" (change)="changeUserFilter($event)" #mcCalendarUser="ngModel"> | ||||
| <option [ngValue]=null>Alle</option> | <option [ngValue]=null>Alle</option> | ||||
| <option *ngFor="let u of selectableUsers; let i = index" value="{{i+1}}">{{u.firstname}} {{u.lastname}}</option> | <option *ngFor="let u of selectableUsers; let i = index" value="{{i+1}}">{{u.firstname}} {{u.lastname}}</option> | ||||
| @@ -19,6 +19,7 @@ export const environment = { | |||||
| apiUrl: 'http://localhost:8000/', | apiUrl: 'http://localhost:8000/', | ||||
| apiAssetPath: 'http://localhost:8000/assets/', | apiAssetPath: 'http://localhost:8000/assets/', | ||||
| debugParam: '?XDEBUG_SESSION_START=', | debugParam: '?XDEBUG_SESSION_START=', | ||||
| //debugParam: '', | |||||
| password: 'plpSpawnTr33!' | password: 'plpSpawnTr33!' | ||||
| }; | }; | ||||