import of initial customer.jdl including related entities
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(customerContact.id)">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
|
||||
(click)="clear()">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<p id="jhi-delete-customerContact-heading" jhiTranslate="hsadminNgApp.customerContact.delete.question" [translateValues]="{id: customerContact.id}">Are you sure you want to delete this Customer Contact?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
|
||||
<fa-icon [icon]="'ban'"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button id="jhi-confirm-delete-customerContact" type="submit" class="btn btn-danger">
|
||||
<fa-icon [icon]="'times'"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,72 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { JhiEventManager } from 'ng-jhipster';
|
||||
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
import { CustomerContactService } from './customer-contact.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-contact-delete-dialog',
|
||||
templateUrl: './customer-contact-delete-dialog.component.html'
|
||||
})
|
||||
export class CustomerContactDeleteDialogComponent {
|
||||
customerContact: ICustomerContact;
|
||||
|
||||
constructor(
|
||||
protected customerContactService: CustomerContactService,
|
||||
public activeModal: NgbActiveModal,
|
||||
protected eventManager: JhiEventManager
|
||||
) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.customerContactService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'customerContactListModification',
|
||||
content: 'Deleted an customerContact'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-contact-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class CustomerContactDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ customerContact }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(CustomerContactDeleteDialogComponent as Component, {
|
||||
size: 'lg',
|
||||
backdrop: 'static'
|
||||
});
|
||||
this.ngbModalRef.componentInstance.customerContact = customerContact;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/customer-contact', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/customer-contact', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="customerContact">
|
||||
<h2><span jhiTranslate="hsadminNgApp.customerContact.detail.title">Customer Contact</span> {{customerContact.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.customerContact.role">Role</span></dt>
|
||||
<dd>
|
||||
<span jhiTranslate="{{'hsadminNgApp.CustomerContactRole.' + customerContact.role}}">{{customerContact.role}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.customerContact.contact">Contact</span></dt>
|
||||
<dd>
|
||||
<div *ngIf="customerContact.contactId">
|
||||
<a [routerLink]="['/contact', customerContact.contactId, 'view']">{{customerContact.contactEmail}}</a>
|
||||
</div>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.customerContact.customer">Customer</span></dt>
|
||||
<dd>
|
||||
<div *ngIf="customerContact.customerId">
|
||||
<a [routerLink]="['/customer', customerContact.customerId, 'view']">{{customerContact.customerPrefix}}</a>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<button type="submit"
|
||||
(click)="previousState()"
|
||||
class="btn btn-info">
|
||||
<fa-icon [icon]="'arrow-left'"></fa-icon> <span jhiTranslate="entity.action.back"> Back</span>
|
||||
</button>
|
||||
|
||||
<button type="button"
|
||||
[routerLink]="['/customer-contact', customerContact.id, 'edit']"
|
||||
class="btn btn-primary">
|
||||
<fa-icon [icon]="'pencil-alt'"></fa-icon> <span jhiTranslate="entity.action.edit"> Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-contact-detail',
|
||||
templateUrl: './customer-contact-detail.component.html'
|
||||
})
|
||||
export class CustomerContactDetailComponent implements OnInit {
|
||||
customerContact: ICustomerContact;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ customerContact }) => {
|
||||
this.customerContact = customerContact;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-customer-contact-heading" jhiTranslate="hsadminNgApp.customerContact.home.createOrEditLabel">Create or edit a Customer Contact</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!customerContact.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="customerContact.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.customerContact.role" for="field_role">Role</label>
|
||||
<select class="form-control" name="role" [(ngModel)]="customerContact.role" id="field_role" required>
|
||||
<option value="CONTRACTUAL">{{'hsadminNgApp.CustomerContactRole.CONTRACTUAL' | translate}}</option>
|
||||
<option value="TECHNICAL">{{'hsadminNgApp.CustomerContactRole.TECHNICAL' | translate}}</option>
|
||||
<option value="FINANCIAL">{{'hsadminNgApp.CustomerContactRole.FINANCIAL' | translate}}</option>
|
||||
</select>
|
||||
<div [hidden]="!(editForm.controls.role?.dirty && editForm.controls.role?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.role?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.customerContact.contact" for="field_contact">Contact</label>
|
||||
<select class="form-control" id="field_contact" name="contact" [(ngModel)]="customerContact.contactId" required>
|
||||
<option *ngIf="!editForm.value.contact" [ngValue]="null" selected></option>
|
||||
<option [ngValue]="contactOption.id" *ngFor="let contactOption of contacts; trackBy: trackContactById">{{contactOption.email}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div [hidden]="!(editForm.controls.contact?.dirty && editForm.controls.contact?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.contact?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.customerContact.customer" for="field_customer">Customer</label>
|
||||
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="customerContact.customerId" required>
|
||||
<option *ngIf="!editForm.value.customer" [ngValue]="null" selected></option>
|
||||
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div [hidden]="!(editForm.controls.customer?.dirty && editForm.controls.customer?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.customer?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
|
||||
<fa-icon [icon]="'ban'"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||
</button>
|
||||
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
|
||||
<fa-icon [icon]="'save'"></fa-icon> <span jhiTranslate="entity.action.save">Save</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,92 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { JhiAlertService } from 'ng-jhipster';
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
import { CustomerContactService } from './customer-contact.service';
|
||||
import { IContact } from 'app/shared/model/contact.model';
|
||||
import { ContactService } from 'app/entities/contact';
|
||||
import { ICustomer } from 'app/shared/model/customer.model';
|
||||
import { CustomerService } from 'app/entities/customer';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-contact-update',
|
||||
templateUrl: './customer-contact-update.component.html'
|
||||
})
|
||||
export class CustomerContactUpdateComponent implements OnInit {
|
||||
customerContact: ICustomerContact;
|
||||
isSaving: boolean;
|
||||
|
||||
contacts: IContact[];
|
||||
|
||||
customers: ICustomer[];
|
||||
|
||||
constructor(
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected customerContactService: CustomerContactService,
|
||||
protected contactService: ContactService,
|
||||
protected customerService: CustomerService,
|
||||
protected activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ customerContact }) => {
|
||||
this.customerContact = customerContact;
|
||||
});
|
||||
this.contactService
|
||||
.query()
|
||||
.pipe(
|
||||
filter((mayBeOk: HttpResponse<IContact[]>) => mayBeOk.ok),
|
||||
map((response: HttpResponse<IContact[]>) => response.body)
|
||||
)
|
||||
.subscribe((res: IContact[]) => (this.contacts = res), (res: HttpErrorResponse) => this.onError(res.message));
|
||||
this.customerService
|
||||
.query()
|
||||
.pipe(
|
||||
filter((mayBeOk: HttpResponse<ICustomer[]>) => mayBeOk.ok),
|
||||
map((response: HttpResponse<ICustomer[]>) => response.body)
|
||||
)
|
||||
.subscribe((res: ICustomer[]) => (this.customers = res), (res: HttpErrorResponse) => this.onError(res.message));
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.isSaving = true;
|
||||
if (this.customerContact.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.customerContactService.update(this.customerContact));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.customerContactService.create(this.customerContact));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<ICustomerContact>>) {
|
||||
result.subscribe((res: HttpResponse<ICustomerContact>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
|
||||
}
|
||||
|
||||
protected onSaveSuccess() {
|
||||
this.isSaving = false;
|
||||
this.previousState();
|
||||
}
|
||||
|
||||
protected onSaveError() {
|
||||
this.isSaving = false;
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
|
||||
trackContactById(index: number, item: IContact) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
trackCustomerById(index: number, item: ICustomer) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.customerContact.home.title">Customer Contacts</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-customer-contact" [routerLink]="['/customer-contact/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.customerContact.home.createLabel">
|
||||
Create new Customer Contact
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="customerContacts">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
|
||||
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="role"><span jhiTranslate="hsadminNgApp.customerContact.role">Role</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="contactEmail"><span jhiTranslate="hsadminNgApp.customerContact.contact">Contact</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="customerPrefix"><span jhiTranslate="hsadminNgApp.customerContact.customer">Customer</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
|
||||
<tr *ngFor="let customerContact of customerContacts ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/customer-contact', customerContact.id, 'view' ]">{{customerContact.id}}</a></td>
|
||||
<td jhiTranslate="{{'hsadminNgApp.CustomerContactRole.' + customerContact.role}}">{{customerContact.role}}</td>
|
||||
<td>
|
||||
<div *ngIf="customerContact.contactId">
|
||||
<a [routerLink]="['../contact', customerContact.contactId , 'view' ]" >{{customerContact.contactEmail}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div *ngIf="customerContact.customerId">
|
||||
<a [routerLink]="['../customer', customerContact.customerId , 'view' ]" >{{customerContact.customerPrefix}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/customer-contact', customerContact.id, 'view' ]"
|
||||
class="btn btn-info btn-sm">
|
||||
<fa-icon [icon]="'eye'"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
|
||||
</button>
|
||||
<button type="submit"
|
||||
[routerLink]="['/customer-contact', customerContact.id, 'edit']"
|
||||
class="btn btn-primary btn-sm">
|
||||
<fa-icon [icon]="'pencil-alt'"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
|
||||
</button>
|
||||
<button type="submit"
|
||||
[routerLink]="['/', 'customer-contact', { outlets: { popup: customerContact.id + '/delete'} }]"
|
||||
replaceUrl="true"
|
||||
queryParamsHandling="merge"
|
||||
class="btn btn-danger btn-sm">
|
||||
<fa-icon [icon]="'times'"></fa-icon>
|
||||
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,108 @@
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
|
||||
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { CustomerContactService } from './customer-contact.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-contact',
|
||||
templateUrl: './customer-contact.component.html'
|
||||
})
|
||||
export class CustomerContactComponent implements OnInit, OnDestroy {
|
||||
customerContacts: ICustomerContact[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected customerContactService: CustomerContactService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.customerContacts = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.customerContactService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<ICustomerContact[]>) => this.paginateCustomerContacts(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.customerContacts = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInCustomerContacts();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: ICustomerContact) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInCustomerContacts() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('customerContactListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateCustomerContacts(data: ICustomerContact[], headers: HttpHeaders) {
|
||||
this.links = this.parseLinks.parse(headers.get('link'));
|
||||
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
this.customerContacts.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { JhiLanguageService } from 'ng-jhipster';
|
||||
import { JhiLanguageHelper } from 'app/core';
|
||||
|
||||
import { HsadminNgSharedModule } from 'app/shared';
|
||||
import {
|
||||
CustomerContactComponent,
|
||||
CustomerContactDetailComponent,
|
||||
CustomerContactUpdateComponent,
|
||||
CustomerContactDeletePopupComponent,
|
||||
CustomerContactDeleteDialogComponent,
|
||||
customerContactRoute,
|
||||
customerContactPopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...customerContactRoute, ...customerContactPopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [
|
||||
CustomerContactComponent,
|
||||
CustomerContactDetailComponent,
|
||||
CustomerContactUpdateComponent,
|
||||
CustomerContactDeleteDialogComponent,
|
||||
CustomerContactDeletePopupComponent
|
||||
],
|
||||
entryComponents: [
|
||||
CustomerContactComponent,
|
||||
CustomerContactUpdateComponent,
|
||||
CustomerContactDeleteDialogComponent,
|
||||
CustomerContactDeletePopupComponent
|
||||
],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgCustomerContactModule {
|
||||
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
|
||||
this.languageHelper.language.subscribe((languageKey: string) => {
|
||||
if (languageKey !== undefined) {
|
||||
this.languageService.changeLanguage(languageKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
|
||||
import { UserRouteAccessService } from 'app/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { CustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
import { CustomerContactService } from './customer-contact.service';
|
||||
import { CustomerContactComponent } from './customer-contact.component';
|
||||
import { CustomerContactDetailComponent } from './customer-contact-detail.component';
|
||||
import { CustomerContactUpdateComponent } from './customer-contact-update.component';
|
||||
import { CustomerContactDeletePopupComponent } from './customer-contact-delete-dialog.component';
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CustomerContactResolve implements Resolve<ICustomerContact> {
|
||||
constructor(private service: CustomerContactService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ICustomerContact> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<CustomerContact>) => response.ok),
|
||||
map((customerContact: HttpResponse<CustomerContact>) => customerContact.body)
|
||||
);
|
||||
}
|
||||
return of(new CustomerContact());
|
||||
}
|
||||
}
|
||||
|
||||
export const customerContactRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: CustomerContactComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customerContact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: CustomerContactDetailComponent,
|
||||
resolve: {
|
||||
customerContact: CustomerContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customerContact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: CustomerContactUpdateComponent,
|
||||
resolve: {
|
||||
customerContact: CustomerContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customerContact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: CustomerContactUpdateComponent,
|
||||
resolve: {
|
||||
customerContact: CustomerContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customerContact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const customerContactPopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: CustomerContactDeletePopupComponent,
|
||||
resolve: {
|
||||
customerContact: CustomerContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customerContact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { SERVER_API_URL } from 'app/app.constants';
|
||||
import { createRequestOption } from 'app/shared';
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<ICustomerContact>;
|
||||
type EntityArrayResponseType = HttpResponse<ICustomerContact[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CustomerContactService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/customer-contacts';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(customerContact: ICustomerContact): Observable<EntityResponseType> {
|
||||
return this.http.post<ICustomerContact>(this.resourceUrl, customerContact, { observe: 'response' });
|
||||
}
|
||||
|
||||
update(customerContact: ICustomerContact): Observable<EntityResponseType> {
|
||||
return this.http.put<ICustomerContact>(this.resourceUrl, customerContact, { observe: 'response' });
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http.get<ICustomerContact>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http.get<ICustomerContact[]>(this.resourceUrl, { params: options, observe: 'response' });
|
||||
}
|
||||
|
||||
delete(id: number): Observable<HttpResponse<any>> {
|
||||
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
}
|
6
src/main/webapp/app/entities/customer-contact/index.ts
Normal file
6
src/main/webapp/app/entities/customer-contact/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './customer-contact.service';
|
||||
export * from './customer-contact-update.component';
|
||||
export * from './customer-contact-delete-dialog.component';
|
||||
export * from './customer-contact-detail.component';
|
||||
export * from './customer-contact.component';
|
||||
export * from './customer-contact.route';
|
Reference in New Issue
Block a user