mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
[HIMA-25] Added process module and process delete dialog component
This commit is contained in:
@@ -24,7 +24,7 @@ export class CheckoutComponent implements OnInit {
|
||||
{ name: 'München Ollenhauerstraße', date: '01.05.2019'},
|
||||
{ name: 'München Pasing Bahnhofsplatz', date: '01.05.2019'},
|
||||
{ name: 'München Theatinerstraße', date: '01.05.2019'}
|
||||
|
||||
|
||||
];
|
||||
currentLocation = this.locations[0];
|
||||
currentPickUpDate = this.locations[0].date;
|
||||
|
||||
@@ -16,13 +16,13 @@ export class ModalService {
|
||||
|
||||
open(id: string) {
|
||||
// open modal specified by id
|
||||
let modal: any = this.modals.filter(x => x.id === id)[0];
|
||||
const modal: any = this.modals.filter(x => x.id === id)[0];
|
||||
modal.open();
|
||||
}
|
||||
|
||||
close(id: string) {
|
||||
// close modal specified by id
|
||||
let modal: any = this.modals.filter(x => x.id === id)[0];
|
||||
const modal: any = this.modals.filter(x => x.id === id)[0];
|
||||
modal.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ProductCardComponent } from '../components/product-card/product-card.co
|
||||
import { ProductDetailsComponent } from '../components/product-details/product-details.component';
|
||||
import { CheckoutComponent } from '../components/checkout/checkout.component';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { ProcessModule } from './process/process.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -48,7 +49,8 @@ import { SharedModule } from '../shared/shared.module';
|
||||
BarcodeSearchModule,
|
||||
DashboardModule,
|
||||
CustomerSearchModule,
|
||||
CartModule
|
||||
CartModule,
|
||||
ProcessModule
|
||||
],
|
||||
exports: [
|
||||
HeaderComponent,
|
||||
@@ -57,7 +59,8 @@ import { SharedModule } from '../shared/shared.module';
|
||||
ContentPageComponent,
|
||||
MenuComponent,
|
||||
BreadcrumbsComponent,
|
||||
InfiniteScrollModule
|
||||
InfiniteScrollModule,
|
||||
ProcessModule
|
||||
]
|
||||
})
|
||||
export class ComponentsModule {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<p>
|
||||
process-delete-dialog works!
|
||||
</p>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProcessDeleteDialogComponent } from './process-delete-dialog.component';
|
||||
|
||||
describe('ProcessDeleteDialogComponent', () => {
|
||||
let component: ProcessDeleteDialogComponent;
|
||||
let fixture: ComponentFixture<ProcessDeleteDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ProcessDeleteDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProcessDeleteDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-process-delete-dialog',
|
||||
templateUrl: './process-delete-dialog.component.html',
|
||||
styleUrls: ['./process-delete-dialog.component.scss']
|
||||
})
|
||||
export class ProcessDeleteDialogComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
11
src/app/modules/process/process.module.ts
Normal file
11
src/app/modules/process/process.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ProcessDeleteDialogComponent } from './process-delete-dialog/process-delete-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ProcessDeleteDialogComponent],
|
||||
imports: [
|
||||
CommonModule
|
||||
]
|
||||
})
|
||||
export class ProcessModule { }
|
||||
@@ -3,7 +3,7 @@ import { ModalService } from '../../../core/services/modal.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-modal',
|
||||
template:
|
||||
template:
|
||||
`<div class="app-modal">
|
||||
<div class="app-modal-body">
|
||||
<ng-content></ng-content>
|
||||
@@ -15,49 +15,49 @@ import { ModalService } from '../../../core/services/modal.service';
|
||||
export class ModalComponent implements OnInit, OnDestroy {
|
||||
@Input() id: string;
|
||||
private element: any;
|
||||
|
||||
|
||||
constructor(private modalService: ModalService, private el: ElementRef) {
|
||||
this.element = el.nativeElement;
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
let modal = this;
|
||||
|
||||
const modal = this;
|
||||
|
||||
// ensure id attribute exists
|
||||
if (!this.id) {
|
||||
console.error('modal must have an id');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// move element to bottom of page (just before </body>) so it can be displayed above everything else
|
||||
document.body.appendChild(this.element);
|
||||
|
||||
|
||||
// close modal on background click
|
||||
this.element.addEventListener('click', function (e: any) {
|
||||
if (e.target.className === 'app-modal') {
|
||||
modal.close();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// add self (this modal instance) to the modal service so it's accessible from controllers
|
||||
this.modalService.add(this);
|
||||
}
|
||||
|
||||
|
||||
// remove self from modal service when directive is destroyed
|
||||
ngOnDestroy(): void {
|
||||
this.modalService.remove(this.id);
|
||||
this.element.remove();
|
||||
}
|
||||
|
||||
|
||||
// open modal
|
||||
open(): void {
|
||||
this.element.children[0].style.display = 'block';
|
||||
document.body.classList.add('app-modal-open');
|
||||
}
|
||||
|
||||
|
||||
// close modal
|
||||
close(): void {
|
||||
this.element.children[0].style.display = 'none';
|
||||
document.body.classList.remove('app-modal-open');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user