import of initial customer.jdl including related entities
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(asset.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-asset-heading" jhiTranslate="hsadminNgApp.asset.delete.question" [translateValues]="{id: asset.id}">Are you sure you want to delete this Asset?</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-asset" 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 { IAsset } from 'app/shared/model/asset.model';
|
||||
import { AssetService } from './asset.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-asset-delete-dialog',
|
||||
templateUrl: './asset-delete-dialog.component.html'
|
||||
})
|
||||
export class AssetDeleteDialogComponent {
|
||||
asset: IAsset;
|
||||
|
||||
constructor(protected assetService: AssetService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.assetService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'assetListModification',
|
||||
content: 'Deleted an asset'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-asset-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class AssetDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ asset }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(AssetDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
|
||||
this.ngbModalRef.componentInstance.asset = asset;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/asset', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/asset', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="asset">
|
||||
<h2><span jhiTranslate="hsadminNgApp.asset.detail.title">Asset</span> {{asset.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.asset.date">Date</span></dt>
|
||||
<dd>
|
||||
<span>{{asset.date}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.asset.action">Action</span></dt>
|
||||
<dd>
|
||||
<span jhiTranslate="{{'hsadminNgApp.AssetAction.' + asset.action}}">{{asset.action}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.asset.amount">Amount</span></dt>
|
||||
<dd>
|
||||
<span>{{asset.amount}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.asset.comment">Comment</span></dt>
|
||||
<dd>
|
||||
<span>{{asset.comment}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.asset.member">Member</span></dt>
|
||||
<dd>
|
||||
<div *ngIf="asset.memberId">
|
||||
<a [routerLink]="['/membership', asset.memberId, 'view']">{{asset.memberId}}</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]="['/asset', asset.id, 'edit']"
|
||||
class="btn btn-primary">
|
||||
<fa-icon [icon]="'pencil-alt'"></fa-icon> <span jhiTranslate="entity.action.edit"> Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
24
src/main/webapp/app/entities/asset/asset-detail.component.ts
Normal file
24
src/main/webapp/app/entities/asset/asset-detail.component.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { IAsset } from 'app/shared/model/asset.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-asset-detail',
|
||||
templateUrl: './asset-detail.component.html'
|
||||
})
|
||||
export class AssetDetailComponent implements OnInit {
|
||||
asset: IAsset;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ asset }) => {
|
||||
this.asset = asset;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-asset-heading" jhiTranslate="hsadminNgApp.asset.home.createOrEditLabel">Create or edit a Asset</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!asset.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="asset.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.date" for="field_date">Date</label>
|
||||
<div class="input-group">
|
||||
<input id="field_date" type="text" class="form-control" name="date" ngbDatepicker #dateDp="ngbDatepicker" [(ngModel)]="asset.date"
|
||||
required/>
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" (click)="dateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
<div [hidden]="!(editForm.controls.date?.dirty && editForm.controls.date?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.date?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.action" for="field_action">Action</label>
|
||||
<select class="form-control" name="action" [(ngModel)]="asset.action" id="field_action" required>
|
||||
<option value="PAYMENT">{{'hsadminNgApp.AssetAction.PAYMENT' | translate}}</option>
|
||||
<option value="HANDOVER">{{'hsadminNgApp.AssetAction.HANDOVER' | translate}}</option>
|
||||
<option value="ADOPTION">{{'hsadminNgApp.AssetAction.ADOPTION' | translate}}</option>
|
||||
<option value="LOSS">{{'hsadminNgApp.AssetAction.LOSS' | translate}}</option>
|
||||
<option value="CLEARING">{{'hsadminNgApp.AssetAction.CLEARING' | translate}}</option>
|
||||
<option value="PAYBACK">{{'hsadminNgApp.AssetAction.PAYBACK' | translate}}</option>
|
||||
</select>
|
||||
<div [hidden]="!(editForm.controls.action?.dirty && editForm.controls.action?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.action?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.amount" for="field_amount">Amount</label>
|
||||
<input type="number" class="form-control" name="amount" id="field_amount"
|
||||
[(ngModel)]="asset.amount" required/>
|
||||
<div [hidden]="!(editForm.controls.amount?.dirty && editForm.controls.amount?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.amount?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.amount?.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.asset.comment" for="field_comment">Comment</label>
|
||||
<input type="text" class="form-control" name="comment" id="field_comment"
|
||||
[(ngModel)]="asset.comment" maxlength="160"/>
|
||||
<div [hidden]="!(editForm.controls.comment?.dirty && editForm.controls.comment?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.comment?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
|
||||
This field cannot be longer than 160 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.member" for="field_member">Member</label>
|
||||
<select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" >
|
||||
<option [ngValue]="null"></option>
|
||||
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
|
||||
</select>
|
||||
</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>
|
78
src/main/webapp/app/entities/asset/asset-update.component.ts
Normal file
78
src/main/webapp/app/entities/asset/asset-update.component.ts
Normal file
@ -0,0 +1,78 @@
|
||||
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 * as moment from 'moment';
|
||||
import { JhiAlertService } from 'ng-jhipster';
|
||||
import { IAsset } from 'app/shared/model/asset.model';
|
||||
import { AssetService } from './asset.service';
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
import { MembershipService } from 'app/entities/membership';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-asset-update',
|
||||
templateUrl: './asset-update.component.html'
|
||||
})
|
||||
export class AssetUpdateComponent implements OnInit {
|
||||
asset: IAsset;
|
||||
isSaving: boolean;
|
||||
|
||||
memberships: IMembership[];
|
||||
dateDp: any;
|
||||
|
||||
constructor(
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected assetService: AssetService,
|
||||
protected membershipService: MembershipService,
|
||||
protected activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ asset }) => {
|
||||
this.asset = asset;
|
||||
});
|
||||
this.membershipService
|
||||
.query()
|
||||
.pipe(
|
||||
filter((mayBeOk: HttpResponse<IMembership[]>) => mayBeOk.ok),
|
||||
map((response: HttpResponse<IMembership[]>) => response.body)
|
||||
)
|
||||
.subscribe((res: IMembership[]) => (this.memberships = res), (res: HttpErrorResponse) => this.onError(res.message));
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.isSaving = true;
|
||||
if (this.asset.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.assetService.update(this.asset));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.assetService.create(this.asset));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IAsset>>) {
|
||||
result.subscribe((res: HttpResponse<IAsset>) => 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);
|
||||
}
|
||||
|
||||
trackMembershipById(index: number, item: IMembership) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
66
src/main/webapp/app/entities/asset/asset.component.html
Normal file
66
src/main/webapp/app/entities/asset/asset.component.html
Normal file
@ -0,0 +1,66 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.asset.home.title">Assets</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-asset" [routerLink]="['/asset/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.asset.home.createLabel">
|
||||
Create new Asset
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="assets">
|
||||
<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="date"><span jhiTranslate="hsadminNgApp.asset.date">Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="action"><span jhiTranslate="hsadminNgApp.asset.action">Action</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="amount"><span jhiTranslate="hsadminNgApp.asset.amount">Amount</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="comment"><span jhiTranslate="hsadminNgApp.asset.comment">Comment</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="memberId"><span jhiTranslate="hsadminNgApp.asset.member">Member</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 asset of assets ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/asset', asset.id, 'view' ]">{{asset.id}}</a></td>
|
||||
<td>{{asset.date | date:'mediumDate'}}</td>
|
||||
<td jhiTranslate="{{'hsadminNgApp.AssetAction.' + asset.action}}">{{asset.action}}</td>
|
||||
<td>{{asset.amount}}</td>
|
||||
<td>{{asset.comment}}</td>
|
||||
<td>
|
||||
<div *ngIf="asset.memberId">
|
||||
<a [routerLink]="['../membership', asset.memberId , 'view' ]" >{{asset.memberId}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/asset', asset.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]="['/asset', asset.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]="['/', 'asset', { outlets: { popup: asset.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/asset/asset.component.ts
Normal file
108
src/main/webapp/app/entities/asset/asset.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 { IAsset } from 'app/shared/model/asset.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { AssetService } from './asset.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-asset',
|
||||
templateUrl: './asset.component.html'
|
||||
})
|
||||
export class AssetComponent implements OnInit, OnDestroy {
|
||||
assets: IAsset[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected assetService: AssetService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.assets = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.assetService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<IAsset[]>) => this.paginateAssets(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.assets = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInAssets();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: IAsset) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInAssets() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('assetListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateAssets(data: IAsset[], 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.assets.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
34
src/main/webapp/app/entities/asset/asset.module.ts
Normal file
34
src/main/webapp/app/entities/asset/asset.module.ts
Normal file
@ -0,0 +1,34 @@
|
||||
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 {
|
||||
AssetComponent,
|
||||
AssetDetailComponent,
|
||||
AssetUpdateComponent,
|
||||
AssetDeletePopupComponent,
|
||||
AssetDeleteDialogComponent,
|
||||
assetRoute,
|
||||
assetPopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...assetRoute, ...assetPopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [AssetComponent, AssetDetailComponent, AssetUpdateComponent, AssetDeleteDialogComponent, AssetDeletePopupComponent],
|
||||
entryComponents: [AssetComponent, AssetUpdateComponent, AssetDeleteDialogComponent, AssetDeletePopupComponent],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgAssetModule {
|
||||
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/asset/asset.route.ts
Normal file
93
src/main/webapp/app/entities/asset/asset.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 { Asset } from 'app/shared/model/asset.model';
|
||||
import { AssetService } from './asset.service';
|
||||
import { AssetComponent } from './asset.component';
|
||||
import { AssetDetailComponent } from './asset-detail.component';
|
||||
import { AssetUpdateComponent } from './asset-update.component';
|
||||
import { AssetDeletePopupComponent } from './asset-delete-dialog.component';
|
||||
import { IAsset } from 'app/shared/model/asset.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AssetResolve implements Resolve<IAsset> {
|
||||
constructor(private service: AssetService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IAsset> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<Asset>) => response.ok),
|
||||
map((asset: HttpResponse<Asset>) => asset.body)
|
||||
);
|
||||
}
|
||||
return of(new Asset());
|
||||
}
|
||||
}
|
||||
|
||||
export const assetRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: AssetComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.asset.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: AssetDetailComponent,
|
||||
resolve: {
|
||||
asset: AssetResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.asset.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: AssetUpdateComponent,
|
||||
resolve: {
|
||||
asset: AssetResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.asset.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: AssetUpdateComponent,
|
||||
resolve: {
|
||||
asset: AssetResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.asset.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const assetPopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: AssetDeletePopupComponent,
|
||||
resolve: {
|
||||
asset: AssetResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.asset.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
74
src/main/webapp/app/entities/asset/asset.service.ts
Normal file
74
src/main/webapp/app/entities/asset/asset.service.ts
Normal file
@ -0,0 +1,74 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import * as moment from 'moment';
|
||||
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { SERVER_API_URL } from 'app/app.constants';
|
||||
import { createRequestOption } from 'app/shared';
|
||||
import { IAsset } from 'app/shared/model/asset.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<IAsset>;
|
||||
type EntityArrayResponseType = HttpResponse<IAsset[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AssetService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/assets';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(asset: IAsset): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(asset);
|
||||
return this.http
|
||||
.post<IAsset>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
update(asset: IAsset): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(asset);
|
||||
return this.http
|
||||
.put<IAsset>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http
|
||||
.get<IAsset>(`${this.resourceUrl}/${id}`, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http
|
||||
.get<IAsset[]>(this.resourceUrl, { params: options, observe: 'response' })
|
||||
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
|
||||
}
|
||||
|
||||
delete(id: number): Observable<HttpResponse<any>> {
|
||||
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
protected convertDateFromClient(asset: IAsset): IAsset {
|
||||
const copy: IAsset = Object.assign({}, asset, {
|
||||
date: asset.date != null && asset.date.isValid() ? asset.date.format(DATE_FORMAT) : null
|
||||
});
|
||||
return copy;
|
||||
}
|
||||
|
||||
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
|
||||
if (res.body) {
|
||||
res.body.date = res.body.date != null ? moment(res.body.date) : null;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
|
||||
if (res.body) {
|
||||
res.body.forEach((asset: IAsset) => {
|
||||
asset.date = asset.date != null ? moment(asset.date) : null;
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
6
src/main/webapp/app/entities/asset/index.ts
Normal file
6
src/main/webapp/app/entities/asset/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './asset.service';
|
||||
export * from './asset-update.component';
|
||||
export * from './asset-delete-dialog.component';
|
||||
export * from './asset-detail.component';
|
||||
export * from './asset.component';
|
||||
export * from './asset.route';
|
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(contact.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-contact-heading" jhiTranslate="hsadminNgApp.contact.delete.question" [translateValues]="{id: contact.id}">Are you sure you want to delete this 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-contact" 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 { IContact } from 'app/shared/model/contact.model';
|
||||
import { ContactService } from './contact.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-contact-delete-dialog',
|
||||
templateUrl: './contact-delete-dialog.component.html'
|
||||
})
|
||||
export class ContactDeleteDialogComponent {
|
||||
contact: IContact;
|
||||
|
||||
constructor(protected contactService: ContactService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.contactService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'contactListModification',
|
||||
content: 'Deleted an contact'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-contact-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class ContactDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ contact }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(ContactDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
|
||||
this.ngbModalRef.componentInstance.contact = contact;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/contact', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/contact', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="contact">
|
||||
<h2><span jhiTranslate="hsadminNgApp.contact.detail.title">Contact</span> {{contact.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.contact.firstName">First Name</span></dt>
|
||||
<dd>
|
||||
<span>{{contact.firstName}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.contact.lastName">Last Name</span></dt>
|
||||
<dd>
|
||||
<span>{{contact.lastName}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.contact.email">Email</span></dt>
|
||||
<dd>
|
||||
<span>{{contact.email}}</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]="['/contact', contact.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 { IContact } from 'app/shared/model/contact.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-contact-detail',
|
||||
templateUrl: './contact-detail.component.html'
|
||||
})
|
||||
export class ContactDetailComponent implements OnInit {
|
||||
contact: IContact;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ contact }) => {
|
||||
this.contact = contact;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-contact-heading" jhiTranslate="hsadminNgApp.contact.home.createOrEditLabel">Create or edit a Contact</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!contact.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="contact.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.contact.firstName" for="field_firstName">First Name</label>
|
||||
<input type="text" class="form-control" name="firstName" id="field_firstName"
|
||||
[(ngModel)]="contact.firstName" required maxlength="80"/>
|
||||
<div [hidden]="!(editForm.controls.firstName?.dirty && editForm.controls.firstName?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.firstName?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.firstName?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
|
||||
This field cannot be longer than 80 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.contact.lastName" for="field_lastName">Last Name</label>
|
||||
<input type="text" class="form-control" name="lastName" id="field_lastName"
|
||||
[(ngModel)]="contact.lastName" required maxlength="80"/>
|
||||
<div [hidden]="!(editForm.controls.lastName?.dirty && editForm.controls.lastName?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.lastName?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.lastName?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
|
||||
This field cannot be longer than 80 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.contact.email" for="field_email">Email</label>
|
||||
<input type="text" class="form-control" name="email" id="field_email"
|
||||
[(ngModel)]="contact.email" required maxlength="80"/>
|
||||
<div [hidden]="!(editForm.controls.email?.dirty && editForm.controls.email?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.email?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.email?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
|
||||
This field cannot be longer than 80 characters.
|
||||
</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 { IContact } from 'app/shared/model/contact.model';
|
||||
import { ContactService } from './contact.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-contact-update',
|
||||
templateUrl: './contact-update.component.html'
|
||||
})
|
||||
export class ContactUpdateComponent implements OnInit {
|
||||
contact: IContact;
|
||||
isSaving: boolean;
|
||||
|
||||
constructor(protected contactService: ContactService, protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ contact }) => {
|
||||
this.contact = contact;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.isSaving = true;
|
||||
if (this.contact.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.contactService.update(this.contact));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.contactService.create(this.contact));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IContact>>) {
|
||||
result.subscribe((res: HttpResponse<IContact>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
|
||||
}
|
||||
|
||||
protected onSaveSuccess() {
|
||||
this.isSaving = false;
|
||||
this.previousState();
|
||||
}
|
||||
|
||||
protected onSaveError() {
|
||||
this.isSaving = false;
|
||||
}
|
||||
}
|
58
src/main/webapp/app/entities/contact/contact.component.html
Normal file
58
src/main/webapp/app/entities/contact/contact.component.html
Normal file
@ -0,0 +1,58 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.contact.home.title">Contacts</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-contact" [routerLink]="['/contact/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.contact.home.createLabel">
|
||||
Create new Contact
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="contacts">
|
||||
<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="firstName"><span jhiTranslate="hsadminNgApp.contact.firstName">First Name</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="lastName"><span jhiTranslate="hsadminNgApp.contact.lastName">Last Name</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="email"><span jhiTranslate="hsadminNgApp.contact.email">Email</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 contact of contacts ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/contact', contact.id, 'view' ]">{{contact.id}}</a></td>
|
||||
<td>{{contact.firstName}}</td>
|
||||
<td>{{contact.lastName}}</td>
|
||||
<td>{{contact.email}}</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/contact', contact.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]="['/contact', contact.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]="['/', 'contact', { outlets: { popup: contact.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/contact/contact.component.ts
Normal file
108
src/main/webapp/app/entities/contact/contact.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 { IContact } from 'app/shared/model/contact.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { ContactService } from './contact.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-contact',
|
||||
templateUrl: './contact.component.html'
|
||||
})
|
||||
export class ContactComponent implements OnInit, OnDestroy {
|
||||
contacts: IContact[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected contactService: ContactService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.contacts = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.contactService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<IContact[]>) => this.paginateContacts(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.contacts = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInContacts();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: IContact) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInContacts() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('contactListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateContacts(data: IContact[], 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.contacts.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
40
src/main/webapp/app/entities/contact/contact.module.ts
Normal file
40
src/main/webapp/app/entities/contact/contact.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 {
|
||||
ContactComponent,
|
||||
ContactDetailComponent,
|
||||
ContactUpdateComponent,
|
||||
ContactDeletePopupComponent,
|
||||
ContactDeleteDialogComponent,
|
||||
contactRoute,
|
||||
contactPopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...contactRoute, ...contactPopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [
|
||||
ContactComponent,
|
||||
ContactDetailComponent,
|
||||
ContactUpdateComponent,
|
||||
ContactDeleteDialogComponent,
|
||||
ContactDeletePopupComponent
|
||||
],
|
||||
entryComponents: [ContactComponent, ContactUpdateComponent, ContactDeleteDialogComponent, ContactDeletePopupComponent],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgContactModule {
|
||||
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/contact/contact.route.ts
Normal file
93
src/main/webapp/app/entities/contact/contact.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 { Contact } from 'app/shared/model/contact.model';
|
||||
import { ContactService } from './contact.service';
|
||||
import { ContactComponent } from './contact.component';
|
||||
import { ContactDetailComponent } from './contact-detail.component';
|
||||
import { ContactUpdateComponent } from './contact-update.component';
|
||||
import { ContactDeletePopupComponent } from './contact-delete-dialog.component';
|
||||
import { IContact } from 'app/shared/model/contact.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ContactResolve implements Resolve<IContact> {
|
||||
constructor(private service: ContactService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IContact> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<Contact>) => response.ok),
|
||||
map((contact: HttpResponse<Contact>) => contact.body)
|
||||
);
|
||||
}
|
||||
return of(new Contact());
|
||||
}
|
||||
}
|
||||
|
||||
export const contactRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ContactComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.contact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: ContactDetailComponent,
|
||||
resolve: {
|
||||
contact: ContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.contact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: ContactUpdateComponent,
|
||||
resolve: {
|
||||
contact: ContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.contact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: ContactUpdateComponent,
|
||||
resolve: {
|
||||
contact: ContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.contact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const contactPopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: ContactDeletePopupComponent,
|
||||
resolve: {
|
||||
contact: ContactResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.contact.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
38
src/main/webapp/app/entities/contact/contact.service.ts
Normal file
38
src/main/webapp/app/entities/contact/contact.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 { IContact } from 'app/shared/model/contact.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<IContact>;
|
||||
type EntityArrayResponseType = HttpResponse<IContact[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ContactService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/contacts';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(contact: IContact): Observable<EntityResponseType> {
|
||||
return this.http.post<IContact>(this.resourceUrl, contact, { observe: 'response' });
|
||||
}
|
||||
|
||||
update(contact: IContact): Observable<EntityResponseType> {
|
||||
return this.http.put<IContact>(this.resourceUrl, contact, { observe: 'response' });
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http.get<IContact>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http.get<IContact[]>(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/contact/index.ts
Normal file
6
src/main/webapp/app/entities/contact/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './contact.service';
|
||||
export * from './contact-update.component';
|
||||
export * from './contact-delete-dialog.component';
|
||||
export * from './contact-detail.component';
|
||||
export * from './contact.component';
|
||||
export * from './contact.route';
|
@ -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';
|
@ -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';
|
@ -4,6 +4,30 @@ import { RouterModule } from '@angular/router';
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: 'customer',
|
||||
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
|
||||
},
|
||||
{
|
||||
path: 'contact',
|
||||
loadChildren: './contact/contact.module#HsadminNgContactModule'
|
||||
},
|
||||
{
|
||||
path: 'customer-contact',
|
||||
loadChildren: './customer-contact/customer-contact.module#HsadminNgCustomerContactModule'
|
||||
},
|
||||
{
|
||||
path: 'membership',
|
||||
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
|
||||
},
|
||||
{
|
||||
path: 'share',
|
||||
loadChildren: './share/share.module#HsadminNgShareModule'
|
||||
},
|
||||
{
|
||||
path: 'asset',
|
||||
loadChildren: './asset/asset.module#HsadminNgAssetModule'
|
||||
}
|
||||
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
|
||||
])
|
||||
],
|
||||
|
6
src/main/webapp/app/entities/membership/index.ts
Normal file
6
src/main/webapp/app/entities/membership/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './membership.service';
|
||||
export * from './membership-update.component';
|
||||
export * from './membership-delete-dialog.component';
|
||||
export * from './membership-detail.component';
|
||||
export * from './membership.component';
|
||||
export * from './membership.route';
|
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(membership.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-membership-heading" jhiTranslate="hsadminNgApp.membership.delete.question" [translateValues]="{id: membership.id}">Are you sure you want to delete this Membership?</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-membership" 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,69 @@
|
||||
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 { IMembership } from 'app/shared/model/membership.model';
|
||||
import { MembershipService } from './membership.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-membership-delete-dialog',
|
||||
templateUrl: './membership-delete-dialog.component.html'
|
||||
})
|
||||
export class MembershipDeleteDialogComponent {
|
||||
membership: IMembership;
|
||||
|
||||
constructor(
|
||||
protected membershipService: MembershipService,
|
||||
public activeModal: NgbActiveModal,
|
||||
protected eventManager: JhiEventManager
|
||||
) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.membershipService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'membershipListModification',
|
||||
content: 'Deleted an membership'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-membership-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class MembershipDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ membership }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(MembershipDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
|
||||
this.ngbModalRef.componentInstance.membership = membership;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/membership', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/membership', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="membership">
|
||||
<h2><span jhiTranslate="hsadminNgApp.membership.detail.title">Membership</span> {{membership.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.membership.sinceDate">Since Date</span></dt>
|
||||
<dd>
|
||||
<span>{{membership.sinceDate}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.membership.untilDate">Until Date</span></dt>
|
||||
<dd>
|
||||
<span>{{membership.untilDate}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.membership.customer">Customer</span></dt>
|
||||
<dd>
|
||||
<div *ngIf="membership.customerId">
|
||||
<a [routerLink]="['/customer', membership.customerId, 'view']">{{membership.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]="['/membership', membership.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 { IMembership } from 'app/shared/model/membership.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-membership-detail',
|
||||
templateUrl: './membership-detail.component.html'
|
||||
})
|
||||
export class MembershipDetailComponent implements OnInit {
|
||||
membership: IMembership;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ membership }) => {
|
||||
this.membership = membership;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-membership-heading" jhiTranslate="hsadminNgApp.membership.home.createOrEditLabel">Create or edit a Membership</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!membership.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="membership.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.sinceDate" for="field_sinceDate">Since Date</label>
|
||||
<div class="input-group">
|
||||
<input id="field_sinceDate" type="text" class="form-control" name="sinceDate" ngbDatepicker #sinceDateDp="ngbDatepicker" [(ngModel)]="membership.sinceDate"
|
||||
required/>
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" (click)="sinceDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
<div [hidden]="!(editForm.controls.sinceDate?.dirty && editForm.controls.sinceDate?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.sinceDate?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.untilDate" for="field_untilDate">Until Date</label>
|
||||
<div class="input-group">
|
||||
<input id="field_untilDate" type="text" class="form-control" name="untilDate" ngbDatepicker #untilDateDp="ngbDatepicker" [(ngModel)]="membership.untilDate"
|
||||
/>
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" (click)="untilDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.customer" for="field_customer">Customer</label>
|
||||
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId" >
|
||||
<option [ngValue]="null"></option>
|
||||
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
|
||||
</select>
|
||||
</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,79 @@
|
||||
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 * as moment from 'moment';
|
||||
import { JhiAlertService } from 'ng-jhipster';
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
import { MembershipService } from './membership.service';
|
||||
import { ICustomer } from 'app/shared/model/customer.model';
|
||||
import { CustomerService } from 'app/entities/customer';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-membership-update',
|
||||
templateUrl: './membership-update.component.html'
|
||||
})
|
||||
export class MembershipUpdateComponent implements OnInit {
|
||||
membership: IMembership;
|
||||
isSaving: boolean;
|
||||
|
||||
customers: ICustomer[];
|
||||
sinceDateDp: any;
|
||||
untilDateDp: any;
|
||||
|
||||
constructor(
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected membershipService: MembershipService,
|
||||
protected customerService: CustomerService,
|
||||
protected activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ membership }) => {
|
||||
this.membership = membership;
|
||||
});
|
||||
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.membership.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.membershipService.update(this.membership));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.membershipService.create(this.membership));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IMembership>>) {
|
||||
result.subscribe((res: HttpResponse<IMembership>) => 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);
|
||||
}
|
||||
|
||||
trackCustomerById(index: number, item: ICustomer) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.membership.home.title">Memberships</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-membership" [routerLink]="['/membership/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.membership.home.createLabel">
|
||||
Create new Membership
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="memberships">
|
||||
<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="sinceDate"><span jhiTranslate="hsadminNgApp.membership.sinceDate">Since Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="untilDate"><span jhiTranslate="hsadminNgApp.membership.untilDate">Until Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="customerPrefix"><span jhiTranslate="hsadminNgApp.membership.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 membership of memberships ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/membership', membership.id, 'view' ]">{{membership.id}}</a></td>
|
||||
<td>{{membership.sinceDate | date:'mediumDate'}}</td>
|
||||
<td>{{membership.untilDate | date:'mediumDate'}}</td>
|
||||
<td>
|
||||
<div *ngIf="membership.customerId">
|
||||
<a [routerLink]="['../customer', membership.customerId , 'view' ]" >{{membership.customerPrefix}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/membership', membership.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]="['/membership', membership.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]="['/', 'membership', { outlets: { popup: membership.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/membership/membership.component.ts
Normal file
108
src/main/webapp/app/entities/membership/membership.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 { IMembership } from 'app/shared/model/membership.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { MembershipService } from './membership.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-membership',
|
||||
templateUrl: './membership.component.html'
|
||||
})
|
||||
export class MembershipComponent implements OnInit, OnDestroy {
|
||||
memberships: IMembership[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected membershipService: MembershipService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.memberships = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.membershipService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<IMembership[]>) => this.paginateMemberships(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.memberships = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInMemberships();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: IMembership) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInMemberships() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('membershipListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateMemberships(data: IMembership[], 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.memberships.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
40
src/main/webapp/app/entities/membership/membership.module.ts
Normal file
40
src/main/webapp/app/entities/membership/membership.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 {
|
||||
MembershipComponent,
|
||||
MembershipDetailComponent,
|
||||
MembershipUpdateComponent,
|
||||
MembershipDeletePopupComponent,
|
||||
MembershipDeleteDialogComponent,
|
||||
membershipRoute,
|
||||
membershipPopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...membershipRoute, ...membershipPopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [
|
||||
MembershipComponent,
|
||||
MembershipDetailComponent,
|
||||
MembershipUpdateComponent,
|
||||
MembershipDeleteDialogComponent,
|
||||
MembershipDeletePopupComponent
|
||||
],
|
||||
entryComponents: [MembershipComponent, MembershipUpdateComponent, MembershipDeleteDialogComponent, MembershipDeletePopupComponent],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgMembershipModule {
|
||||
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/membership/membership.route.ts
Normal file
93
src/main/webapp/app/entities/membership/membership.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 { Membership } from 'app/shared/model/membership.model';
|
||||
import { MembershipService } from './membership.service';
|
||||
import { MembershipComponent } from './membership.component';
|
||||
import { MembershipDetailComponent } from './membership-detail.component';
|
||||
import { MembershipUpdateComponent } from './membership-update.component';
|
||||
import { MembershipDeletePopupComponent } from './membership-delete-dialog.component';
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class MembershipResolve implements Resolve<IMembership> {
|
||||
constructor(private service: MembershipService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IMembership> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<Membership>) => response.ok),
|
||||
map((membership: HttpResponse<Membership>) => membership.body)
|
||||
);
|
||||
}
|
||||
return of(new Membership());
|
||||
}
|
||||
}
|
||||
|
||||
export const membershipRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MembershipComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.membership.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: MembershipDetailComponent,
|
||||
resolve: {
|
||||
membership: MembershipResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.membership.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: MembershipUpdateComponent,
|
||||
resolve: {
|
||||
membership: MembershipResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.membership.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: MembershipUpdateComponent,
|
||||
resolve: {
|
||||
membership: MembershipResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.membership.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const membershipPopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: MembershipDeletePopupComponent,
|
||||
resolve: {
|
||||
membership: MembershipResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.membership.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
@ -0,0 +1,77 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import * as moment from 'moment';
|
||||
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { SERVER_API_URL } from 'app/app.constants';
|
||||
import { createRequestOption } from 'app/shared';
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<IMembership>;
|
||||
type EntityArrayResponseType = HttpResponse<IMembership[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class MembershipService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/memberships';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(membership: IMembership): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(membership);
|
||||
return this.http
|
||||
.post<IMembership>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
update(membership: IMembership): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(membership);
|
||||
return this.http
|
||||
.put<IMembership>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http
|
||||
.get<IMembership>(`${this.resourceUrl}/${id}`, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http
|
||||
.get<IMembership[]>(this.resourceUrl, { params: options, observe: 'response' })
|
||||
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
|
||||
}
|
||||
|
||||
delete(id: number): Observable<HttpResponse<any>> {
|
||||
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
protected convertDateFromClient(membership: IMembership): IMembership {
|
||||
const copy: IMembership = Object.assign({}, membership, {
|
||||
sinceDate: membership.sinceDate != null && membership.sinceDate.isValid() ? membership.sinceDate.format(DATE_FORMAT) : null,
|
||||
untilDate: membership.untilDate != null && membership.untilDate.isValid() ? membership.untilDate.format(DATE_FORMAT) : null
|
||||
});
|
||||
return copy;
|
||||
}
|
||||
|
||||
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
|
||||
if (res.body) {
|
||||
res.body.sinceDate = res.body.sinceDate != null ? moment(res.body.sinceDate) : null;
|
||||
res.body.untilDate = res.body.untilDate != null ? moment(res.body.untilDate) : null;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
|
||||
if (res.body) {
|
||||
res.body.forEach((membership: IMembership) => {
|
||||
membership.sinceDate = membership.sinceDate != null ? moment(membership.sinceDate) : null;
|
||||
membership.untilDate = membership.untilDate != null ? moment(membership.untilDate) : null;
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
6
src/main/webapp/app/entities/share/index.ts
Normal file
6
src/main/webapp/app/entities/share/index.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export * from './share.service';
|
||||
export * from './share-update.component';
|
||||
export * from './share-delete-dialog.component';
|
||||
export * from './share-detail.component';
|
||||
export * from './share.component';
|
||||
export * from './share.route';
|
@ -0,0 +1,19 @@
|
||||
<form name="deleteForm" (ngSubmit)="confirmDelete(share.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-share-heading" jhiTranslate="hsadminNgApp.share.delete.question" [translateValues]="{id: share.id}">Are you sure you want to delete this Share?</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-share" 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 { IShare } from 'app/shared/model/share.model';
|
||||
import { ShareService } from './share.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-share-delete-dialog',
|
||||
templateUrl: './share-delete-dialog.component.html'
|
||||
})
|
||||
export class ShareDeleteDialogComponent {
|
||||
share: IShare;
|
||||
|
||||
constructor(protected shareService: ShareService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
|
||||
|
||||
clear() {
|
||||
this.activeModal.dismiss('cancel');
|
||||
}
|
||||
|
||||
confirmDelete(id: number) {
|
||||
this.shareService.delete(id).subscribe(response => {
|
||||
this.eventManager.broadcast({
|
||||
name: 'shareListModification',
|
||||
content: 'Deleted an share'
|
||||
});
|
||||
this.activeModal.dismiss(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-share-delete-popup',
|
||||
template: ''
|
||||
})
|
||||
export class ShareDeletePopupComponent implements OnInit, OnDestroy {
|
||||
protected ngbModalRef: NgbModalRef;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ share }) => {
|
||||
setTimeout(() => {
|
||||
this.ngbModalRef = this.modalService.open(ShareDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
|
||||
this.ngbModalRef.componentInstance.share = share;
|
||||
this.ngbModalRef.result.then(
|
||||
result => {
|
||||
this.router.navigate(['/share', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
},
|
||||
reason => {
|
||||
this.router.navigate(['/share', { outlets: { popup: null } }]);
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.ngbModalRef = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<div *ngIf="share">
|
||||
<h2><span jhiTranslate="hsadminNgApp.share.detail.title">Share</span> {{share.id}}</h2>
|
||||
<hr>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<dl class="row-md jh-entity-details">
|
||||
<dt><span jhiTranslate="hsadminNgApp.share.date">Date</span></dt>
|
||||
<dd>
|
||||
<span>{{share.date}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.share.action">Action</span></dt>
|
||||
<dd>
|
||||
<span jhiTranslate="{{'hsadminNgApp.ShareAction.' + share.action}}">{{share.action}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.share.quantity">Quantity</span></dt>
|
||||
<dd>
|
||||
<span>{{share.quantity}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.share.comment">Comment</span></dt>
|
||||
<dd>
|
||||
<span>{{share.comment}}</span>
|
||||
</dd>
|
||||
<dt><span jhiTranslate="hsadminNgApp.share.member">Member</span></dt>
|
||||
<dd>
|
||||
<div *ngIf="share.memberId">
|
||||
<a [routerLink]="['/membership', share.memberId, 'view']">{{share.memberId}}</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]="['/share', share.id, 'edit']"
|
||||
class="btn btn-primary">
|
||||
<fa-icon [icon]="'pencil-alt'"></fa-icon> <span jhiTranslate="entity.action.edit"> Edit</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
24
src/main/webapp/app/entities/share/share-detail.component.ts
Normal file
24
src/main/webapp/app/entities/share/share-detail.component.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { IShare } from 'app/shared/model/share.model';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-share-detail',
|
||||
templateUrl: './share-detail.component.html'
|
||||
})
|
||||
export class ShareDetailComponent implements OnInit {
|
||||
share: IShare;
|
||||
|
||||
constructor(protected activatedRoute: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.activatedRoute.data.subscribe(({ share }) => {
|
||||
this.share = share;
|
||||
});
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-8">
|
||||
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
|
||||
<h2 id="jhi-share-heading" jhiTranslate="hsadminNgApp.share.home.createOrEditLabel">Create or edit a Share</h2>
|
||||
<div>
|
||||
<jhi-alert-error></jhi-alert-error>
|
||||
<div class="form-group" [hidden]="!share.id">
|
||||
<label for="id" jhiTranslate="global.field.id">ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id"
|
||||
[(ngModel)]="share.id" readonly />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.date" for="field_date">Date</label>
|
||||
<div class="input-group">
|
||||
<input id="field_date" type="text" class="form-control" name="date" ngbDatepicker #dateDp="ngbDatepicker" [(ngModel)]="share.date"
|
||||
required/>
|
||||
<span class="input-group-append">
|
||||
<button type="button" class="btn btn-secondary" (click)="dateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
|
||||
</span>
|
||||
</div>
|
||||
<div [hidden]="!(editForm.controls.date?.dirty && editForm.controls.date?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.date?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.action" for="field_action">Action</label>
|
||||
<select class="form-control" name="action" [(ngModel)]="share.action" id="field_action" required>
|
||||
<option value="SUBSCRIPTION">{{'hsadminNgApp.ShareAction.SUBSCRIPTION' | translate}}</option>
|
||||
<option value="CANCELLATION">{{'hsadminNgApp.ShareAction.CANCELLATION' | translate}}</option>
|
||||
</select>
|
||||
<div [hidden]="!(editForm.controls.action?.dirty && editForm.controls.action?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.action?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.quantity" for="field_quantity">Quantity</label>
|
||||
<input type="number" class="form-control" name="quantity" id="field_quantity"
|
||||
[(ngModel)]="share.quantity" required/>
|
||||
<div [hidden]="!(editForm.controls.quantity?.dirty && editForm.controls.quantity?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.quantity?.errors?.required" jhiTranslate="entity.validation.required">
|
||||
This field is required.
|
||||
</small>
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.quantity?.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.share.comment" for="field_comment">Comment</label>
|
||||
<input type="text" class="form-control" name="comment" id="field_comment"
|
||||
[(ngModel)]="share.comment" maxlength="160"/>
|
||||
<div [hidden]="!(editForm.controls.comment?.dirty && editForm.controls.comment?.invalid)">
|
||||
<small class="form-text text-danger"
|
||||
[hidden]="!editForm.controls.comment?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
|
||||
This field cannot be longer than 160 characters.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.member" for="field_member">Member</label>
|
||||
<select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" >
|
||||
<option [ngValue]="null"></option>
|
||||
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
|
||||
</select>
|
||||
</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>
|
78
src/main/webapp/app/entities/share/share-update.component.ts
Normal file
78
src/main/webapp/app/entities/share/share-update.component.ts
Normal file
@ -0,0 +1,78 @@
|
||||
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 * as moment from 'moment';
|
||||
import { JhiAlertService } from 'ng-jhipster';
|
||||
import { IShare } from 'app/shared/model/share.model';
|
||||
import { ShareService } from './share.service';
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
import { MembershipService } from 'app/entities/membership';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-share-update',
|
||||
templateUrl: './share-update.component.html'
|
||||
})
|
||||
export class ShareUpdateComponent implements OnInit {
|
||||
share: IShare;
|
||||
isSaving: boolean;
|
||||
|
||||
memberships: IMembership[];
|
||||
dateDp: any;
|
||||
|
||||
constructor(
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected shareService: ShareService,
|
||||
protected membershipService: MembershipService,
|
||||
protected activatedRoute: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isSaving = false;
|
||||
this.activatedRoute.data.subscribe(({ share }) => {
|
||||
this.share = share;
|
||||
});
|
||||
this.membershipService
|
||||
.query()
|
||||
.pipe(
|
||||
filter((mayBeOk: HttpResponse<IMembership[]>) => mayBeOk.ok),
|
||||
map((response: HttpResponse<IMembership[]>) => response.body)
|
||||
)
|
||||
.subscribe((res: IMembership[]) => (this.memberships = res), (res: HttpErrorResponse) => this.onError(res.message));
|
||||
}
|
||||
|
||||
previousState() {
|
||||
window.history.back();
|
||||
}
|
||||
|
||||
save() {
|
||||
this.isSaving = true;
|
||||
if (this.share.id !== undefined) {
|
||||
this.subscribeToSaveResponse(this.shareService.update(this.share));
|
||||
} else {
|
||||
this.subscribeToSaveResponse(this.shareService.create(this.share));
|
||||
}
|
||||
}
|
||||
|
||||
protected subscribeToSaveResponse(result: Observable<HttpResponse<IShare>>) {
|
||||
result.subscribe((res: HttpResponse<IShare>) => 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);
|
||||
}
|
||||
|
||||
trackMembershipById(index: number, item: IMembership) {
|
||||
return item.id;
|
||||
}
|
||||
}
|
66
src/main/webapp/app/entities/share/share.component.html
Normal file
66
src/main/webapp/app/entities/share/share.component.html
Normal file
@ -0,0 +1,66 @@
|
||||
<div>
|
||||
<h2 id="page-heading">
|
||||
<span jhiTranslate="hsadminNgApp.share.home.title">Shares</span>
|
||||
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-share" [routerLink]="['/share/new']">
|
||||
<fa-icon [icon]="'plus'"></fa-icon>
|
||||
<span jhiTranslate="hsadminNgApp.share.home.createLabel">
|
||||
Create new Share
|
||||
</span>
|
||||
</button>
|
||||
</h2>
|
||||
<jhi-alert></jhi-alert>
|
||||
<br/>
|
||||
<div class="table-responsive" *ngIf="shares">
|
||||
<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="date"><span jhiTranslate="hsadminNgApp.share.date">Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="action"><span jhiTranslate="hsadminNgApp.share.action">Action</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="quantity"><span jhiTranslate="hsadminNgApp.share.quantity">Quantity</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="comment"><span jhiTranslate="hsadminNgApp.share.comment">Comment</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||
<th jhiSortBy="memberId"><span jhiTranslate="hsadminNgApp.share.member">Member</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 share of shares ;trackBy: trackId">
|
||||
<td><a [routerLink]="['/share', share.id, 'view' ]">{{share.id}}</a></td>
|
||||
<td>{{share.date | date:'mediumDate'}}</td>
|
||||
<td jhiTranslate="{{'hsadminNgApp.ShareAction.' + share.action}}">{{share.action}}</td>
|
||||
<td>{{share.quantity}}</td>
|
||||
<td>{{share.comment}}</td>
|
||||
<td>
|
||||
<div *ngIf="share.memberId">
|
||||
<a [routerLink]="['../membership', share.memberId , 'view' ]" >{{share.memberId}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group flex-btn-group-container">
|
||||
<button type="submit"
|
||||
[routerLink]="['/share', share.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]="['/share', share.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]="['/', 'share', { outlets: { popup: share.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/share/share.component.ts
Normal file
108
src/main/webapp/app/entities/share/share.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 { IShare } from 'app/shared/model/share.model';
|
||||
import { AccountService } from 'app/core';
|
||||
|
||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||
import { ShareService } from './share.service';
|
||||
|
||||
@Component({
|
||||
selector: 'jhi-share',
|
||||
templateUrl: './share.component.html'
|
||||
})
|
||||
export class ShareComponent implements OnInit, OnDestroy {
|
||||
shares: IShare[];
|
||||
currentAccount: any;
|
||||
eventSubscriber: Subscription;
|
||||
itemsPerPage: number;
|
||||
links: any;
|
||||
page: any;
|
||||
predicate: any;
|
||||
reverse: any;
|
||||
totalItems: number;
|
||||
|
||||
constructor(
|
||||
protected shareService: ShareService,
|
||||
protected jhiAlertService: JhiAlertService,
|
||||
protected eventManager: JhiEventManager,
|
||||
protected parseLinks: JhiParseLinks,
|
||||
protected accountService: AccountService
|
||||
) {
|
||||
this.shares = [];
|
||||
this.itemsPerPage = ITEMS_PER_PAGE;
|
||||
this.page = 0;
|
||||
this.links = {
|
||||
last: 0
|
||||
};
|
||||
this.predicate = 'id';
|
||||
this.reverse = true;
|
||||
}
|
||||
|
||||
loadAll() {
|
||||
this.shareService
|
||||
.query({
|
||||
page: this.page,
|
||||
size: this.itemsPerPage,
|
||||
sort: this.sort()
|
||||
})
|
||||
.subscribe(
|
||||
(res: HttpResponse<IShare[]>) => this.paginateShares(res.body, res.headers),
|
||||
(res: HttpErrorResponse) => this.onError(res.message)
|
||||
);
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.page = 0;
|
||||
this.shares = [];
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
loadPage(page) {
|
||||
this.page = page;
|
||||
this.loadAll();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loadAll();
|
||||
this.accountService.identity().then(account => {
|
||||
this.currentAccount = account;
|
||||
});
|
||||
this.registerChangeInShares();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.eventManager.destroy(this.eventSubscriber);
|
||||
}
|
||||
|
||||
trackId(index: number, item: IShare) {
|
||||
return item.id;
|
||||
}
|
||||
|
||||
registerChangeInShares() {
|
||||
this.eventSubscriber = this.eventManager.subscribe('shareListModification', response => this.reset());
|
||||
}
|
||||
|
||||
sort() {
|
||||
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
|
||||
if (this.predicate !== 'id') {
|
||||
result.push('id');
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected paginateShares(data: IShare[], 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.shares.push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
protected onError(errorMessage: string) {
|
||||
this.jhiAlertService.error(errorMessage, null, null);
|
||||
}
|
||||
}
|
34
src/main/webapp/app/entities/share/share.module.ts
Normal file
34
src/main/webapp/app/entities/share/share.module.ts
Normal file
@ -0,0 +1,34 @@
|
||||
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 {
|
||||
ShareComponent,
|
||||
ShareDetailComponent,
|
||||
ShareUpdateComponent,
|
||||
ShareDeletePopupComponent,
|
||||
ShareDeleteDialogComponent,
|
||||
shareRoute,
|
||||
sharePopupRoute
|
||||
} from './';
|
||||
|
||||
const ENTITY_STATES = [...shareRoute, ...sharePopupRoute];
|
||||
|
||||
@NgModule({
|
||||
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
|
||||
declarations: [ShareComponent, ShareDetailComponent, ShareUpdateComponent, ShareDeleteDialogComponent, ShareDeletePopupComponent],
|
||||
entryComponents: [ShareComponent, ShareUpdateComponent, ShareDeleteDialogComponent, ShareDeletePopupComponent],
|
||||
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class HsadminNgShareModule {
|
||||
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/share/share.route.ts
Normal file
93
src/main/webapp/app/entities/share/share.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 { Share } from 'app/shared/model/share.model';
|
||||
import { ShareService } from './share.service';
|
||||
import { ShareComponent } from './share.component';
|
||||
import { ShareDetailComponent } from './share-detail.component';
|
||||
import { ShareUpdateComponent } from './share-update.component';
|
||||
import { ShareDeletePopupComponent } from './share-delete-dialog.component';
|
||||
import { IShare } from 'app/shared/model/share.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ShareResolve implements Resolve<IShare> {
|
||||
constructor(private service: ShareService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IShare> {
|
||||
const id = route.params['id'] ? route.params['id'] : null;
|
||||
if (id) {
|
||||
return this.service.find(id).pipe(
|
||||
filter((response: HttpResponse<Share>) => response.ok),
|
||||
map((share: HttpResponse<Share>) => share.body)
|
||||
);
|
||||
}
|
||||
return of(new Share());
|
||||
}
|
||||
}
|
||||
|
||||
export const shareRoute: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ShareComponent,
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.share.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/view',
|
||||
component: ShareDetailComponent,
|
||||
resolve: {
|
||||
share: ShareResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.share.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: 'new',
|
||||
component: ShareUpdateComponent,
|
||||
resolve: {
|
||||
share: ShareResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.share.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
},
|
||||
{
|
||||
path: ':id/edit',
|
||||
component: ShareUpdateComponent,
|
||||
resolve: {
|
||||
share: ShareResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.share.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService]
|
||||
}
|
||||
];
|
||||
|
||||
export const sharePopupRoute: Routes = [
|
||||
{
|
||||
path: ':id/delete',
|
||||
component: ShareDeletePopupComponent,
|
||||
resolve: {
|
||||
share: ShareResolve
|
||||
},
|
||||
data: {
|
||||
authorities: ['ROLE_USER'],
|
||||
pageTitle: 'hsadminNgApp.share.home.title'
|
||||
},
|
||||
canActivate: [UserRouteAccessService],
|
||||
outlet: 'popup'
|
||||
}
|
||||
];
|
74
src/main/webapp/app/entities/share/share.service.ts
Normal file
74
src/main/webapp/app/entities/share/share.service.ts
Normal file
@ -0,0 +1,74 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import * as moment from 'moment';
|
||||
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { SERVER_API_URL } from 'app/app.constants';
|
||||
import { createRequestOption } from 'app/shared';
|
||||
import { IShare } from 'app/shared/model/share.model';
|
||||
|
||||
type EntityResponseType = HttpResponse<IShare>;
|
||||
type EntityArrayResponseType = HttpResponse<IShare[]>;
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ShareService {
|
||||
public resourceUrl = SERVER_API_URL + 'api/shares';
|
||||
|
||||
constructor(protected http: HttpClient) {}
|
||||
|
||||
create(share: IShare): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(share);
|
||||
return this.http
|
||||
.post<IShare>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
update(share: IShare): Observable<EntityResponseType> {
|
||||
const copy = this.convertDateFromClient(share);
|
||||
return this.http
|
||||
.put<IShare>(this.resourceUrl, copy, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
find(id: number): Observable<EntityResponseType> {
|
||||
return this.http
|
||||
.get<IShare>(`${this.resourceUrl}/${id}`, { observe: 'response' })
|
||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||
}
|
||||
|
||||
query(req?: any): Observable<EntityArrayResponseType> {
|
||||
const options = createRequestOption(req);
|
||||
return this.http
|
||||
.get<IShare[]>(this.resourceUrl, { params: options, observe: 'response' })
|
||||
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
|
||||
}
|
||||
|
||||
delete(id: number): Observable<HttpResponse<any>> {
|
||||
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
|
||||
}
|
||||
|
||||
protected convertDateFromClient(share: IShare): IShare {
|
||||
const copy: IShare = Object.assign({}, share, {
|
||||
date: share.date != null && share.date.isValid() ? share.date.format(DATE_FORMAT) : null
|
||||
});
|
||||
return copy;
|
||||
}
|
||||
|
||||
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
|
||||
if (res.body) {
|
||||
res.body.date = res.body.date != null ? moment(res.body.date) : null;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
|
||||
if (res.body) {
|
||||
res.body.forEach((share: IShare) => {
|
||||
share.date = share.date != null ? moment(share.date) : null;
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@ -27,6 +27,42 @@
|
||||
</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" ngbDropdownMenu aria-labelledby="entity-menu">
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="customer" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.customer">Customer</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="contact" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.contact">Contact</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="customer-contact" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.customerContact">Customer Contact</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="membership" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.membership">Membership</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="share" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.share">Share</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" routerLink="asset" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
|
||||
<fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
|
||||
<span jhiTranslate="global.menu.entities.asset">Asset</span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->
|
||||
</ul>
|
||||
</li>
|
||||
|
30
src/main/webapp/app/shared/model/asset.model.ts
Normal file
30
src/main/webapp/app/shared/model/asset.model.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { Moment } from 'moment';
|
||||
|
||||
export const enum AssetAction {
|
||||
PAYMENT = 'PAYMENT',
|
||||
HANDOVER = 'HANDOVER',
|
||||
ADOPTION = 'ADOPTION',
|
||||
LOSS = 'LOSS',
|
||||
CLEARING = 'CLEARING',
|
||||
PAYBACK = 'PAYBACK'
|
||||
}
|
||||
|
||||
export interface IAsset {
|
||||
id?: number;
|
||||
date?: Moment;
|
||||
action?: AssetAction;
|
||||
amount?: number;
|
||||
comment?: string;
|
||||
memberId?: number;
|
||||
}
|
||||
|
||||
export class Asset implements IAsset {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public date?: Moment,
|
||||
public action?: AssetAction,
|
||||
public amount?: number,
|
||||
public comment?: string,
|
||||
public memberId?: number
|
||||
) {}
|
||||
}
|
19
src/main/webapp/app/shared/model/contact.model.ts
Normal file
19
src/main/webapp/app/shared/model/contact.model.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
|
||||
export interface IContact {
|
||||
id?: number;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
email?: string;
|
||||
roles?: ICustomerContact[];
|
||||
}
|
||||
|
||||
export class Contact implements IContact {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public firstName?: string,
|
||||
public lastName?: string,
|
||||
public email?: string,
|
||||
public roles?: ICustomerContact[]
|
||||
) {}
|
||||
}
|
25
src/main/webapp/app/shared/model/customer-contact.model.ts
Normal file
25
src/main/webapp/app/shared/model/customer-contact.model.ts
Normal file
@ -0,0 +1,25 @@
|
||||
export const enum CustomerContactRole {
|
||||
CONTRACTUAL = 'CONTRACTUAL',
|
||||
TECHNICAL = 'TECHNICAL',
|
||||
FINANCIAL = 'FINANCIAL'
|
||||
}
|
||||
|
||||
export interface ICustomerContact {
|
||||
id?: number;
|
||||
role?: CustomerContactRole;
|
||||
contactEmail?: string;
|
||||
contactId?: number;
|
||||
customerPrefix?: string;
|
||||
customerId?: number;
|
||||
}
|
||||
|
||||
export class CustomerContact implements ICustomerContact {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public role?: CustomerContactRole,
|
||||
public contactEmail?: string,
|
||||
public contactId?: number,
|
||||
public customerPrefix?: string,
|
||||
public customerId?: number
|
||||
) {}
|
||||
}
|
20
src/main/webapp/app/shared/model/customer.model.ts
Normal file
20
src/main/webapp/app/shared/model/customer.model.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { IMembership } from 'app/shared/model/membership.model';
|
||||
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
|
||||
|
||||
export interface ICustomer {
|
||||
id?: number;
|
||||
number?: number;
|
||||
prefix?: string;
|
||||
memberships?: IMembership[];
|
||||
roles?: ICustomerContact[];
|
||||
}
|
||||
|
||||
export class Customer implements ICustomer {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public number?: number,
|
||||
public prefix?: string,
|
||||
public memberships?: IMembership[],
|
||||
public roles?: ICustomerContact[]
|
||||
) {}
|
||||
}
|
25
src/main/webapp/app/shared/model/membership.model.ts
Normal file
25
src/main/webapp/app/shared/model/membership.model.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { Moment } from 'moment';
|
||||
import { IShare } from 'app/shared/model/share.model';
|
||||
import { IAsset } from 'app/shared/model/asset.model';
|
||||
|
||||
export interface IMembership {
|
||||
id?: number;
|
||||
sinceDate?: Moment;
|
||||
untilDate?: Moment;
|
||||
shares?: IShare[];
|
||||
assets?: IAsset[];
|
||||
customerPrefix?: string;
|
||||
customerId?: number;
|
||||
}
|
||||
|
||||
export class Membership implements IMembership {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public sinceDate?: Moment,
|
||||
public untilDate?: Moment,
|
||||
public shares?: IShare[],
|
||||
public assets?: IAsset[],
|
||||
public customerPrefix?: string,
|
||||
public customerId?: number
|
||||
) {}
|
||||
}
|
26
src/main/webapp/app/shared/model/share.model.ts
Normal file
26
src/main/webapp/app/shared/model/share.model.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Moment } from 'moment';
|
||||
|
||||
export const enum ShareAction {
|
||||
SUBSCRIPTION = 'SUBSCRIPTION',
|
||||
CANCELLATION = 'CANCELLATION'
|
||||
}
|
||||
|
||||
export interface IShare {
|
||||
id?: number;
|
||||
date?: Moment;
|
||||
action?: ShareAction;
|
||||
quantity?: number;
|
||||
comment?: string;
|
||||
memberId?: number;
|
||||
}
|
||||
|
||||
export class Share implements IShare {
|
||||
constructor(
|
||||
public id?: number,
|
||||
public date?: Moment,
|
||||
public action?: ShareAction,
|
||||
public quantity?: number,
|
||||
public comment?: string,
|
||||
public memberId?: number
|
||||
) {}
|
||||
}
|
25
src/main/webapp/i18n/de/asset.json
Normal file
25
src/main/webapp/i18n/de/asset.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"asset": {
|
||||
"home": {
|
||||
"title": "Assets",
|
||||
"createLabel": "Asset erstellen",
|
||||
"createOrEditLabel": "Asset erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Asset erstellt mit ID {{ param }}",
|
||||
"updated": "Asset aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Asset gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Asset {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Asset"
|
||||
},
|
||||
"date": "Date",
|
||||
"action": "Action",
|
||||
"amount": "Amount",
|
||||
"comment": "Comment",
|
||||
"member": "Member"
|
||||
}
|
||||
}
|
||||
}
|
13
src/main/webapp/i18n/de/assetAction.json
Normal file
13
src/main/webapp/i18n/de/assetAction.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"AssetAction": {
|
||||
"null": "",
|
||||
"PAYMENT": "PAYMENT",
|
||||
"HANDOVER": "HANDOVER",
|
||||
"ADOPTION": "ADOPTION",
|
||||
"LOSS": "LOSS",
|
||||
"CLEARING": "CLEARING",
|
||||
"PAYBACK": "PAYBACK"
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/webapp/i18n/de/contact.json
Normal file
24
src/main/webapp/i18n/de/contact.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"contact": {
|
||||
"home": {
|
||||
"title": "Contacts",
|
||||
"createLabel": "Contact erstellen",
|
||||
"createOrEditLabel": "Contact erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Contact erstellt mit ID {{ param }}",
|
||||
"updated": "Contact aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Contact gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Contact {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Contact"
|
||||
},
|
||||
"firstName": "First Name",
|
||||
"lastName": "Last Name",
|
||||
"email": "Email",
|
||||
"role": "Role"
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/webapp/i18n/de/customer.json
Normal file
24
src/main/webapp/i18n/de/customer.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"customer": {
|
||||
"home": {
|
||||
"title": "Customers",
|
||||
"createLabel": "Customer erstellen",
|
||||
"createOrEditLabel": "Customer erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Customer erstellt mit ID {{ param }}",
|
||||
"updated": "Customer aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Customer gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Customer {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Customer"
|
||||
},
|
||||
"number": "Number",
|
||||
"prefix": "Prefix",
|
||||
"membership": "Membership",
|
||||
"role": "Role"
|
||||
}
|
||||
}
|
||||
}
|
23
src/main/webapp/i18n/de/customerContact.json
Normal file
23
src/main/webapp/i18n/de/customerContact.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"customerContact": {
|
||||
"home": {
|
||||
"title": "Customer Contacts",
|
||||
"createLabel": "Customer Contact erstellen",
|
||||
"createOrEditLabel": "Customer Contact erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Customer Contact erstellt mit ID {{ param }}",
|
||||
"updated": "Customer Contact aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Customer Contact gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Customer Contact {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Customer Contact"
|
||||
},
|
||||
"role": "Role",
|
||||
"contact": "Contact",
|
||||
"customer": "Customer"
|
||||
}
|
||||
}
|
||||
}
|
10
src/main/webapp/i18n/de/customerContactRole.json
Normal file
10
src/main/webapp/i18n/de/customerContactRole.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"CustomerContactRole": {
|
||||
"null": "",
|
||||
"CONTRACTUAL": "CONTRACTUAL",
|
||||
"TECHNICAL": "TECHNICAL",
|
||||
"FINANCIAL": "FINANCIAL"
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,12 @@
|
||||
"jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)",
|
||||
"entities": {
|
||||
"main": "Entitäten",
|
||||
"customer": "Customer",
|
||||
"contact": "Contact",
|
||||
"customerContact": "Customer Contact",
|
||||
"membership": "Membership",
|
||||
"share": "Share",
|
||||
"asset": "Asset",
|
||||
"jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
|
||||
},
|
||||
"account": {
|
||||
|
25
src/main/webapp/i18n/de/membership.json
Normal file
25
src/main/webapp/i18n/de/membership.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"membership": {
|
||||
"home": {
|
||||
"title": "Memberships",
|
||||
"createLabel": "Membership erstellen",
|
||||
"createOrEditLabel": "Membership erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Membership erstellt mit ID {{ param }}",
|
||||
"updated": "Membership aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Membership gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Membership {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Membership"
|
||||
},
|
||||
"sinceDate": "Since Date",
|
||||
"untilDate": "Until Date",
|
||||
"share": "Share",
|
||||
"asset": "Asset",
|
||||
"customer": "Customer"
|
||||
}
|
||||
}
|
||||
}
|
25
src/main/webapp/i18n/de/share.json
Normal file
25
src/main/webapp/i18n/de/share.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"share": {
|
||||
"home": {
|
||||
"title": "Shares",
|
||||
"createLabel": "Share erstellen",
|
||||
"createOrEditLabel": "Share erstellen oder bearbeiten"
|
||||
},
|
||||
"created": "Share erstellt mit ID {{ param }}",
|
||||
"updated": "Share aktualisiert mit ID {{ param }}",
|
||||
"deleted": "Share gelöscht mit ID {{ param }}",
|
||||
"delete": {
|
||||
"question": "Soll Share {{ id }} wirklich dauerhaft gelöscht werden?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Share"
|
||||
},
|
||||
"date": "Date",
|
||||
"action": "Action",
|
||||
"quantity": "Quantity",
|
||||
"comment": "Comment",
|
||||
"member": "Member"
|
||||
}
|
||||
}
|
||||
}
|
9
src/main/webapp/i18n/de/shareAction.json
Normal file
9
src/main/webapp/i18n/de/shareAction.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"ShareAction": {
|
||||
"null": "",
|
||||
"SUBSCRIPTION": "SUBSCRIPTION",
|
||||
"CANCELLATION": "CANCELLATION"
|
||||
}
|
||||
}
|
||||
}
|
25
src/main/webapp/i18n/en/asset.json
Normal file
25
src/main/webapp/i18n/en/asset.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"asset": {
|
||||
"home": {
|
||||
"title": "Assets",
|
||||
"createLabel": "Create a new Asset",
|
||||
"createOrEditLabel": "Create or edit a Asset"
|
||||
},
|
||||
"created": "A new Asset is created with identifier {{ param }}",
|
||||
"updated": "A Asset is updated with identifier {{ param }}",
|
||||
"deleted": "A Asset is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Asset {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Asset"
|
||||
},
|
||||
"date": "Date",
|
||||
"action": "Action",
|
||||
"amount": "Amount",
|
||||
"comment": "Comment",
|
||||
"member": "Member"
|
||||
}
|
||||
}
|
||||
}
|
13
src/main/webapp/i18n/en/assetAction.json
Normal file
13
src/main/webapp/i18n/en/assetAction.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"AssetAction": {
|
||||
"null": "",
|
||||
"PAYMENT": "PAYMENT",
|
||||
"HANDOVER": "HANDOVER",
|
||||
"ADOPTION": "ADOPTION",
|
||||
"LOSS": "LOSS",
|
||||
"CLEARING": "CLEARING",
|
||||
"PAYBACK": "PAYBACK"
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/webapp/i18n/en/contact.json
Normal file
24
src/main/webapp/i18n/en/contact.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"contact": {
|
||||
"home": {
|
||||
"title": "Contacts",
|
||||
"createLabel": "Create a new Contact",
|
||||
"createOrEditLabel": "Create or edit a Contact"
|
||||
},
|
||||
"created": "A new Contact is created with identifier {{ param }}",
|
||||
"updated": "A Contact is updated with identifier {{ param }}",
|
||||
"deleted": "A Contact is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Contact {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Contact"
|
||||
},
|
||||
"firstName": "First Name",
|
||||
"lastName": "Last Name",
|
||||
"email": "Email",
|
||||
"role": "Role"
|
||||
}
|
||||
}
|
||||
}
|
24
src/main/webapp/i18n/en/customer.json
Normal file
24
src/main/webapp/i18n/en/customer.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"customer": {
|
||||
"home": {
|
||||
"title": "Customers",
|
||||
"createLabel": "Create a new Customer",
|
||||
"createOrEditLabel": "Create or edit a Customer"
|
||||
},
|
||||
"created": "A new Customer is created with identifier {{ param }}",
|
||||
"updated": "A Customer is updated with identifier {{ param }}",
|
||||
"deleted": "A Customer is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Customer {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Customer"
|
||||
},
|
||||
"number": "Number",
|
||||
"prefix": "Prefix",
|
||||
"membership": "Membership",
|
||||
"role": "Role"
|
||||
}
|
||||
}
|
||||
}
|
23
src/main/webapp/i18n/en/customerContact.json
Normal file
23
src/main/webapp/i18n/en/customerContact.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"customerContact": {
|
||||
"home": {
|
||||
"title": "Customer Contacts",
|
||||
"createLabel": "Create a new Customer Contact",
|
||||
"createOrEditLabel": "Create or edit a Customer Contact"
|
||||
},
|
||||
"created": "A new Customer Contact is created with identifier {{ param }}",
|
||||
"updated": "A Customer Contact is updated with identifier {{ param }}",
|
||||
"deleted": "A Customer Contact is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Customer Contact {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Customer Contact"
|
||||
},
|
||||
"role": "Role",
|
||||
"contact": "Contact",
|
||||
"customer": "Customer"
|
||||
}
|
||||
}
|
||||
}
|
10
src/main/webapp/i18n/en/customerContactRole.json
Normal file
10
src/main/webapp/i18n/en/customerContactRole.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"CustomerContactRole": {
|
||||
"null": "",
|
||||
"CONTRACTUAL": "CONTRACTUAL",
|
||||
"TECHNICAL": "TECHNICAL",
|
||||
"FINANCIAL": "FINANCIAL"
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,12 @@
|
||||
"jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)",
|
||||
"entities": {
|
||||
"main": "Entities",
|
||||
"customer": "Customer",
|
||||
"contact": "Contact",
|
||||
"customerContact": "Customer Contact",
|
||||
"membership": "Membership",
|
||||
"share": "Share",
|
||||
"asset": "Asset",
|
||||
"jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
|
||||
},
|
||||
"account": {
|
||||
|
25
src/main/webapp/i18n/en/membership.json
Normal file
25
src/main/webapp/i18n/en/membership.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"membership": {
|
||||
"home": {
|
||||
"title": "Memberships",
|
||||
"createLabel": "Create a new Membership",
|
||||
"createOrEditLabel": "Create or edit a Membership"
|
||||
},
|
||||
"created": "A new Membership is created with identifier {{ param }}",
|
||||
"updated": "A Membership is updated with identifier {{ param }}",
|
||||
"deleted": "A Membership is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Membership {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Membership"
|
||||
},
|
||||
"sinceDate": "Since Date",
|
||||
"untilDate": "Until Date",
|
||||
"share": "Share",
|
||||
"asset": "Asset",
|
||||
"customer": "Customer"
|
||||
}
|
||||
}
|
||||
}
|
25
src/main/webapp/i18n/en/share.json
Normal file
25
src/main/webapp/i18n/en/share.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"share": {
|
||||
"home": {
|
||||
"title": "Shares",
|
||||
"createLabel": "Create a new Share",
|
||||
"createOrEditLabel": "Create or edit a Share"
|
||||
},
|
||||
"created": "A new Share is created with identifier {{ param }}",
|
||||
"updated": "A Share is updated with identifier {{ param }}",
|
||||
"deleted": "A Share is deleted with identifier {{ param }}",
|
||||
"delete": {
|
||||
"question": "Are you sure you want to delete Share {{ id }}?"
|
||||
},
|
||||
"detail": {
|
||||
"title": "Share"
|
||||
},
|
||||
"date": "Date",
|
||||
"action": "Action",
|
||||
"quantity": "Quantity",
|
||||
"comment": "Comment",
|
||||
"member": "Member"
|
||||
}
|
||||
}
|
||||
}
|
9
src/main/webapp/i18n/en/shareAction.json
Normal file
9
src/main/webapp/i18n/en/shareAction.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"hsadminNgApp": {
|
||||
"ShareAction": {
|
||||
"null": "",
|
||||
"SUBSCRIPTION": "SUBSCRIPTION",
|
||||
"CANCELLATION": "CANCELLATION"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user