import { Component, Injector, Input, Output, EventEmitter, OnInit, AfterViewInit, ElementRef, ViewContainerRef, HostBinding, ViewChild } from '@angular/core'; import { AppComponentBase } from "@shared/common/app-component-base"; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { LocalStorageService } from '@shared/utils/local-storage.service'; import { Router } from '@angular/router'; import { CreateRouteModalComponent } from '@app/sprintship/routes/create-routes-modal.component'; @Component({ selector: 'addCreateSomething', templateUrl: './add-create-something.component.html', animations: [appModuleAnimation()] // styleUrls: ['address-form.component.less'] }) export class AddCreateSomethingComponent extends AppComponentBase { @HostBinding('id') id = 'kt_quick_sidebar'; @HostBinding('class') classes = 'kt-quick-panel'; @HostBinding('attr.mQuickSidebarOffcanvas') @HostBinding('style.overflow') styleOverflow: any = 'hidden'; // @ViewChild('createRouteModal', {static: false}) createRouteModal: CreateRouteModalComponent; // @ViewChild('createRouteModal', {static: false}) createRouteModal: CreateRouteModalComponent; mQuickSidebarOffcanvas: any; constructor( injector: Injector, private _localStorageService: LocalStorageService, private el: ElementRef, private router: Router, private viewContainerRef: ViewContainerRef, ) { super(injector); } _isOpen: boolean; _pinned = false; getParentComponent() { return this.viewContainerRef['_data'].componentView.component.viewContainerRef['_view'].component } ngOnInit(): void { } ngAfterViewInit(): void { this.mQuickSidebarOffcanvas = new KTOffcanvas(this.el.nativeElement, { overlay: true, baseClass: 'kt-quick-panel', closeBy: 'add-create-something-close', toggleBy: 'add-create-something-toggle' }); this.mQuickSidebarOffcanvas.events.push({ name: 'afterHide', handler: () => { if (this._pinned) { this.mQuickSidebarOffcanvas.show(); } else { this.isOpen = false; } } }, { name: 'afterShow', handler: () => { this.isOpen = true; } }); } set pinned(newValue: boolean) { if (newValue === this._pinned) { return; } this._pinned = newValue; } get pinned(): boolean { return this._pinned; } reversePinned(): void { this.pinned = !this.pinned; } set isOpen(newValue: boolean) { if (newValue === this._isOpen) { return; } this._isOpen = newValue; } get isOpen(): boolean { return this._isOpen; } createRoute(): void { // this.createRouteModal.show(); } }