import of initial customer.jdl including related entities
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(customer.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-customer-heading" jhiTranslate="hsadminNgApp.customer.delete.question" [translateValues]="{id: customer.id}">Are you sure you want to delete this Customer?</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-customer" 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,65 @@
|
||||
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 { ICustomer } from 'app/shared/model/customer.model';
|
||||
import { CustomerService } from './customer.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-delete-dialog',
|
||||
templateUrl: './customer-delete-dialog.component.html'
|
||||
})
|
||||
export class CustomerDeleteDialogComponent {
|
||||
customer: ICustomer;
|
||||
|
||||
constructor(protected customerService: CustomerService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.customerService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'customerListModification',
|
||||
content: 'Deleted an customer'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class CustomerDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ customer }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(CustomerDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
|
||||
this.ngbModalRef.componentInstance.customer = customer;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/customer', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/customer', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="customer">
|
||||
<h2><span jhiTranslate="hsadminNgApp.customer.detail.title">Customer</span> {{customer.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.customer.number">Number</span></dt>
|
||||
<dd>
|
||||
<span>{{customer.number}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span></dt>
|
||||
<dd>
|
||||
<span>{{customer.prefix}}</span>
|
||||
</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', customer.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 { ICustomer } from 'app/shared/model/customer.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-detail',
|
||||
templateUrl: './customer-detail.component.html'
|
||||
})
|
||||
export class CustomerDetailComponent implements OnInit {
|
||||
customer: ICustomer;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ customer }) => {
|
||||
this.customer = customer;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-customer-heading" jhiTranslate="hsadminNgApp.customer.home.createOrEditLabel">Create or edit a Customer</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!customer.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="customer.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.number" for="field_number">Number</label>
|
||||
<input type="number" class="form-control" name="number" id="field_number"
|
||||
[(ngModel)]="customer.number" required min="10000" jhiMin="10000" max="99999" jhiMax="99999"/>
|
||||
<div [hidden]="!(editForm.controls.number?.dirty && editForm.controls.number?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.number?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.number?.errors?.min" jhiTranslate="entity.validation.min" [translateValues]="{ min: 10000 }">
|
||||
This field should be at least 10000.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.number?.errors?.max" jhiTranslate="entity.validation.max" [translateValues]="{ max: 99999 }">
|
||||
This field cannot be more than 99999.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.number?.errors?.number" jhiTranslate="entity.validation.number">
|
||||
This field should be a number.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.prefix" for="field_prefix">Prefix</label>
|
||||
<input type="text" class="form-control" name="prefix" id="field_prefix"
|
||||
[(ngModel)]="customer.prefix" required pattern="[a-z][a-z0-9]+"/>
|
||||
<div [hidden]="!(editForm.controls.prefix?.dirty && editForm.controls.prefix?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.prefix?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.prefix?.errors?.pattern" jhiTranslate="entity.validation.pattern" [translateValues]="{ pattern: 'Prefix' }">
|
||||
This field should follow pattern for "Prefix".
|
||||
</small>
|
||||
</div>
|
||||
</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,51 @@
|
||||
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 { ICustomer } from 'app/shared/model/customer.model';
|
||||
import { CustomerService } from './customer.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer-update',
|
||||
templateUrl: './customer-update.component.html'
|
||||
})
|
||||
export class CustomerUpdateComponent implements OnInit {
|
||||
customer: ICustomer;
|
||||
isSaving: boolean;
|
||||
|
||||
constructor(protected customerService: CustomerService, protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ customer }) => {
|
||||
this.customer = customer;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.isSaving = true;
|
||||
if (this.customer.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.customerService.update(this.customer));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.customerService.create(this.customer));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<ICustomer>>) {
|
||||
result.subscribe((res: HttpResponse<ICustomer>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
|
||||
}
|
||||
|
||||
protected onSaveSuccess() {
|
||||
this.isSaving = false;
|
||||
this.previousState();
|
||||
}
|
||||
|
||||
protected onSaveError() {
|
||||
this.isSaving = false;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.customer.home.title">Customers</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-customer" [routerLink]="['/customer/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.customer.home.createLabel">
|
||||
Create new Customer
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="customers">
|
||||
<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="number"><span jhiTranslate="hsadminNgApp.customer.number">Number</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="prefix"><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</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 customer of customers ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/customer', customer.id, 'view' ]">{{customer.id}}</a></td>
|
||||
<td>{{customer.number}}</td>
|
||||
<td>{{customer.prefix}}</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/customer', customer.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', customer.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', { outlets: { popup: customer.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>
|
108
src/main/webapp/app/entities/customer/customer.component.ts
Normal file
108
src/main/webapp/app/entities/customer/customer.component.ts
Normal file
@ -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 { ICustomer } from 'app/shared/model/customer.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { CustomerService } from './customer.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-customer',
|
||||
templateUrl: './customer.component.html'
|
||||
})
|
||||
export class CustomerComponent implements OnInit, OnDestroy {
|
||||
customers: ICustomer[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected customerService: CustomerService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.customers = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.customerService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<ICustomer[]>) => this.paginateCustomers(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.customers = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInCustomers();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: ICustomer) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInCustomers() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('customerListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateCustomers(data: ICustomer[], 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.customers.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
40
src/main/webapp/app/entities/customer/customer.module.ts
Normal file
40
src/main/webapp/app/entities/customer/customer.module.ts
Normal file
@ -0,0 +1,40 @@
|
||||
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 {
|
||||
CustomerComponent,
|
||||
CustomerDetailComponent,
|
||||
CustomerUpdateComponent,
|
||||
CustomerDeletePopupComponent,
|
||||
CustomerDeleteDialogComponent,
|
||||
customerRoute,
|
||||
customerPopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...customerRoute, ...customerPopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [
|
||||
CustomerComponent,
|
||||
CustomerDetailComponent,
|
||||
CustomerUpdateComponent,
|
||||
CustomerDeleteDialogComponent,
|
||||
CustomerDeletePopupComponent
|
||||
],
|
||||
entryComponents: [CustomerComponent, CustomerUpdateComponent, CustomerDeleteDialogComponent, CustomerDeletePopupComponent],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgCustomerModule {
|
||||
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
|
||||
this.languageHelper.language.subscribe((languageKey: string) => {
|
||||
if (languageKey !== undefined) {
|
||||
this.languageService.changeLanguage(languageKey);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
93
src/main/webapp/app/entities/customer/customer.route.ts
Normal file
93
src/main/webapp/app/entities/customer/customer.route.ts
Normal file
@ -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 { Customer } from 'app/shared/model/customer.model';
|
||||
import { CustomerService } from './customer.service';
|
||||
import { CustomerComponent } from './customer.component';
|
||||
import { CustomerDetailComponent } from './customer-detail.component';
|
||||
import { CustomerUpdateComponent } from './customer-update.component';
|
||||
import { CustomerDeletePopupComponent } from './customer-delete-dialog.component';
|
||||
import { ICustomer } from 'app/shared/model/customer.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CustomerResolve implements Resolve<ICustomer> {
|
||||
constructor(private service: CustomerService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ICustomer> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<Customer>) => response.ok),
|
||||
map((customer: HttpResponse<Customer>) => customer.body)
|
||||
);
|
||||
}
|
||||
return of(new Customer());
|
||||
}
|
||||
}
|
||||
|
||||
export const customerRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: CustomerComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customer.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: CustomerDetailComponent,
|
||||
resolve: {
|
||||
customer: CustomerResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customer.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: CustomerUpdateComponent,
|
||||
resolve: {
|
||||
customer: CustomerResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customer.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: CustomerUpdateComponent,
|
||||
resolve: {
|
||||
customer: CustomerResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customer.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const customerPopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: CustomerDeletePopupComponent,
|
||||
resolve: {
|
||||
customer: CustomerResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.customer.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
38
src/main/webapp/app/entities/customer/customer.service.ts
Normal file
38
src/main/webapp/app/entities/customer/customer.service.ts
Normal file
@ -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 { ICustomer } from 'app/shared/model/customer.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<ICustomer>;
|
||||
type EntityArrayResponseType = HttpResponse<ICustomer[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CustomerService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/customers';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(customer: ICustomer): Observable<EntityResponseType> {
|
||||
return this.http.post<ICustomer>(this.resourceUrl, customer, { observe: 'response' });
|
||||
}
|
||||
|
||||
update(customer: ICustomer): Observable<EntityResponseType> {
|
||||
return this.http.put<ICustomer>(this.resourceUrl, customer, { observe: 'response' });
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http.get<ICustomer>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http.get<ICustomer[]>(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/index.ts
Normal file
6
src/main/webapp/app/entities/customer/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './customer.service';
|
||||
export * from './customer-update.component';
|
||||
export * from './customer-delete-dialog.component';
|
||||
export * from './customer-detail.component';
|
||||
export * from './customer.component';
|
||||
export * from './customer.route';
|
Reference in New Issue
Block a user