- [KON-150]: FE Serviceaufruf um Suchfelder für Filterung erweitern
- [KON-158]: FE Serviceaufruf um Sortierung erweitern
Signed-off-by: Dennis Schmitt <dennis.schmitt@pta.de>
diff --git a/i18n/contacts.de.json b/i18n/contacts.de.json
index 8f307ac..09fa04b 100644
--- a/i18n/contacts.de.json
+++ b/i18n/contacts.de.json
@@ -2,13 +2,23 @@
"Contacts": {
"Title": "Übersicht Kontakte",
"Name": "Name",
+ "FirstName": "Vorname",
+ "LastName": "Nachname",
"ContactType": "Kontakttyp",
"Note": "Notiz",
"MainAddress": "Hauptadresse",
+ "Street": "Straße",
+ "Community": "Ort",
"CreateNewContact": "Neuer Kontakt anlegen",
- "InternContact": "Interner Kontakt",
- "ExternContact": "Externer Kontakt",
- "Company": "Unternehmen"
+ "InternalContact": "Interner Kontakt",
+ "ExternalContact": "Externer Kontakt",
+ "Company": "Unternehmen",
+ "Department": "Abteilung",
+ "PersonTypes": "Personentypen",
+ "AllPersonTypes": "Alle Personentypen",
+ "InvoiceRecipient": "Rechnungsempfänger",
+ "ExecutiveDirector": "Geschäftsführer",
+ "Lawyer": "Rechtsanwalt"
},
"ProductDetails": {
"Title": "Details",
diff --git a/i18n/en.json b/i18n/en.json
index 8f307ac..09fa04b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -2,13 +2,23 @@
"Contacts": {
"Title": "Übersicht Kontakte",
"Name": "Name",
+ "FirstName": "Vorname",
+ "LastName": "Nachname",
"ContactType": "Kontakttyp",
"Note": "Notiz",
"MainAddress": "Hauptadresse",
+ "Street": "Straße",
+ "Community": "Ort",
"CreateNewContact": "Neuer Kontakt anlegen",
- "InternContact": "Interner Kontakt",
- "ExternContact": "Externer Kontakt",
- "Company": "Unternehmen"
+ "InternalContact": "Interner Kontakt",
+ "ExternalContact": "Externer Kontakt",
+ "Company": "Unternehmen",
+ "Department": "Abteilung",
+ "PersonTypes": "Personentypen",
+ "AllPersonTypes": "Alle Personentypen",
+ "InvoiceRecipient": "Rechnungsempfänger",
+ "ExecutiveDirector": "Geschäftsführer",
+ "Lawyer": "Rechtsanwalt"
},
"ProductDetails": {
"Title": "Details",
diff --git a/i18n/general.de.json b/i18n/general.de.json
index 64e828d..aca6fe4 100644
--- a/i18n/general.de.json
+++ b/i18n/general.de.json
@@ -12,6 +12,13 @@
"CancelBtn": "Abbrechen",
"BackBtn": "Zurück",
"GridEmptyLabel": "Keine Daten vorhanden!",
+ "Filtering": "Filterung",
+ "Sorting": "Sortierung",
+ "NoSorting": "Keine Sortierung",
+ "Ascending": "Aufsteigend",
+ "Descending": "Absteigend",
+ "Column": "Spalte",
+
"ConfirmDialog": {
"Title": "Bitte bestätigen Sie",
diff --git a/src/app/pages/contacts/contacts-api-client.ts b/src/app/pages/contacts/contacts-api-client.ts
index 8b7e235..53cfd10 100644
--- a/src/app/pages/contacts/contacts-api-client.ts
+++ b/src/app/pages/contacts/contacts-api-client.ts
@@ -1,3 +1,5 @@
+import { ModifyContacts } from '../../shared/models/modifyContacts.model';
+import { Action } from '@ngrx/store';
import { Injectable } from '@angular/core';
import { HttpService, Query, GET, Path, Adapter, PUT, Body, DefaultHeaders } from '@shared/asyncServices/http';
import { Observable } from 'rxjs';
@@ -14,7 +16,8 @@
})
export class ContactsApiClient extends HttpService {
public getContacts(request: PageRequestInterface = null): Observable<PageModel<Contact>> {
- return request !== null ? this._getContactsPage(request.pageNumber ? (request.pageNumber-1) : 0, request.pageSize) : this._getContacts();
+ const modifyContacts: ModifyContacts = request.queryParameter || {};
+ return this._getContactsPage(modifyContacts.searchText, modifyContacts.personTypeId, modifyContacts.sort, request.pageNumber ? (request.pageNumber - 1) : 0, request.pageSize);
}
/**
@@ -22,17 +25,10 @@
*/
@GET('/contacts')
@Adapter(ContactsService.gridPageAdapter)
- private _getContactsPage(@Query('page') pageNumber: number, @Query('size') pageSize: number): Observable<any> {
+ private _getContactsPage(@Query('searchText') searchtext: string, @Query('personTypeId') personTypeId: string, @Query('sort') sort: string, @Query('page') pageNumber: number, @Query('size') pageSize: number): Observable<any> {
return null;
}
- /**
- * Retrieves all non-paged contacts
- */
- @GET('/contacts')
- @Adapter(ContactsService.gridAdapter)
- private _getContacts(): Observable<any> {
- return null;
- }
+
/**
* Retrieves product details by a given id
*
diff --git a/src/app/pages/contacts/contacts-list/contacts-list-column-definition.ts b/src/app/pages/contacts/contacts-list/contacts-list-column-definition.ts
index 1b2aebf..914c811 100644
--- a/src/app/pages/contacts/contacts-list/contacts-list-column-definition.ts
+++ b/src/app/pages/contacts/contacts-list/contacts-list-column-definition.ts
@@ -3,22 +3,34 @@
export const CONTACTS_COLDEF = [
{
field: 'name',
+ colId: 'name',
headerName: 'Contacts.Name',
sortable: true,
- filter: 'agTextColumnFilter',
+ filter: true,
+ filterParams: {
+ debounceMs: 1000
+ }
},
{
field: 'contactType',
+ colId: 'contactType',
headerName: 'Contacts.ContactType',
sortable: true,
- filter: 'agTextColumnFilter',
+ filter: true,
+ filterParams: {
+ debounceMs: 1000
+ },
cellRendererFramework: ContactTypeCellRendererComponent
},
{
field: 'note',
+ colId: 'note',
headerName: 'Contacts.Note',
sortable: true,
- filter: 'agTextColumnFilter',
+ filter: true,
+ filterParams: {
+ debounceMs: 1000
+ }
},
{
valueGetter: function(params) {
@@ -28,8 +40,22 @@
return '';
}
},
+ colId: 'mainaddress',
headerName: 'Contacts.MainAddress',
sortable: true,
- filter: 'agTextColumnFilter',
- }
+ filter: true,
+ filterParams: {
+ debounceMs: 1000
+ }
+ },
+ {
+ field: 'department',
+ colId: 'department',
+ headerName: 'Contacts.Department',
+ sortable: true,
+ filter: true,
+ filterParams: {
+ debounceMs: 1000
+ },
+ },
];
diff --git a/src/app/pages/contacts/contacts-list/contacts-list.component.html b/src/app/pages/contacts/contacts-list/contacts-list.component.html
index a325b1c..6f1596f 100644
--- a/src/app/pages/contacts/contacts-list/contacts-list.component.html
+++ b/src/app/pages/contacts/contacts-list/contacts-list.component.html
@@ -4,12 +4,47 @@
</div>
<div class="contacts-grid-wrapper" body>
- <div class="diverse-btn">
+ <div class="diverse-options">
+ <div class="filtering diverse-options-item">
+ <div class="filter-options">
+ <span>{{ 'Filtering' | translate }}: </span>
+ <input type="text" class="item" id="searchText" [(ngModel)]="contactsSandbox.modifyContacts.searchText" (change)="contactsSandbox.filterEvent()" size="20">
+
+ <select [required]="false" type="text" class="form-control" [(ngModel)]="contactsSandbox.modifyContacts.personTypeId" (change)="contactsSandbox.filterEvent()">
+ <option value="" disabled selected>{{ 'Contacts.PersonTypes' | translate }}</option>
+ <option value="2eb4885e-7363-4918-90ed-b7d5d84cfd3f">{{ 'Contacts.InvoiceRecipient' | translate }}</option>
+ <option value="a7522c72-14d0-4e9d-afe3-bfcb3ffbec10">{{ 'Contacts.ExecutiveDirector' | translate }}</option>
+ <option value="47ce68b7-6d44-453e-b421-19020fd791b5">{{ 'Contacts.Lawyer' | translate }}</option>
+ <option value="">{{ 'Contacts.AllPersonTypes' | translate }}</option>
+ </select>
+ </div>
+ </div>
+
+ <div class="sorting-options diverse-options-item">
+ <span class="item">{{ 'Sorting' | translate }}: </span>
+
+ <select [required]="false" type="text" class="form-control" [(ngModel)]="contactsSandbox.contactProperty" (change)="contactsSandbox.sortEvent()">
+ <option value="" disabled selected>{{ 'Column' | translate }}</option>
+ <option value="name">{{ 'Contacts.Name' | translate }}</option>
+ <option value="contactType">{{ 'Contacts.ContactType' | translate }}</option>
+ <option value="note">{{ 'Contacts.Note' | translate }}</option>
+ <option value="street">{{ 'Contacts.Street' | translate }}</option>
+ <option value="community">{{ 'Contacts.Community' | translate }}</option>
+ <option value="department">{{ 'Contacts.Department' | translate }}</option>
+ <option value="">{{ 'NoSorting' | translate }}</option>
+ </select>
+
+ <select [required]="false" type="text" class="form-control" [(ngModel)]="contactsSandbox.sortingStatus" (change)="contactsSandbox.sortEvent()">
+ <option value="asc" selected>{{ 'Ascending' | translate }}</option>
+ <option value="desc">{{ 'Descending' | translate }}</option>
+ </select>
+ </div>
+
<div class="selectTypeOfNewContact">
<select [required]="false" type="text" class="form-control" (change)="navigateTo($event.target.value)">
<option value="" disabled selected>{{ 'Contacts.CreateNewContact' | translate }}</option>
- <option value="/new_intern_contact">{{ 'Contacts.InternContact' | translate }}</option>
- <option value="/new_extern_contact">{{ 'Contacts.ExternContact' | translate }}</option>
+ <option value="/new_intern_contact">{{ 'Contacts.InternalContact' | translate }}</option>
+ <option value="/new_extern_contact">{{ 'Contacts.ExternalContact' | translate }}</option>
<option value="/new_company">{{ 'Contacts.Company' | translate }}</option>
</select>
</div>
@@ -17,13 +52,14 @@
<ag-grid-angular
[serverside]="contactsSandbox.serversideModel"
+ [queryParameter]="contactsSandbox.modifyContacts"
autoresizecolumns
class="ag-theme-balham"
[gridOptions]="gridOptions"
[columnDefs]="columnDefinition"
[rowSelection]="'single'"
- [floatingFilter]="true"
[frameworkComponents]="frameworkComponents"
+ (gridReady)="onGridReady($event)"
>
</ag-grid-angular>
<app-spinner [isRunning]="contactsSandbox.contactsLoading$ | async"></app-spinner>
diff --git a/src/app/pages/contacts/contacts-list/contacts-list.component.scss b/src/app/pages/contacts/contacts-list/contacts-list.component.scss
index 6212e64..88d9a19 100644
--- a/src/app/pages/contacts/contacts-list/contacts-list.component.scss
+++ b/src/app/pages/contacts/contacts-list/contacts-list.component.scss
@@ -1,33 +1,91 @@
.contacts-grid-wrapper {
- position: relative;
+ position: relative;
}
.dropdown-open:hover {
- background-color: transparent;
+ background-color: transparent;
}
-.diverse-btn{
- display: flex;
- justify-content: flex-end;
- background-color: #f5f7f7;
- border: 1px solid rgb(189, 195, 199);
- padding: 7px 7px 5px 0px;
- margin-bottom: 1px;
+.diverse-options {
+ display: flex;
+ justify-content: space-between;
+ align-content: center;
+ background-color: #f5f7f7;
+ border: 1px solid rgb(189, 195, 199);
+ padding: 7px 7px 5px 7px;
+ margin-bottom: 1px;
}
+.diverse-options-item{
+ padding-right: 7px;
+ border-right: solid 1px #ddd;
+}
-ag-grid-angular{
- height: calc(100vh - 275px);
+ag-grid-angular {
+ height: calc(100vh - 275px);
}
.form-field-label {
- width: 100%;
- font-size: 14px;
- font-weight: bold;
- margin-bottom: 5px;
+ width: 100%;
+ font-size: 13px;
+ font-weight: bold;
+ margin-bottom: 5px;
}
-.selectTypeOfNewContact{
- margin-right: 2px;
- margin-bottom: 2px;
+.selectTypeOfNewContact {
+ align-self: center;
+ margin-right: 2px;
+}
+
+.filtering{
+ display: flex;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+
+
+}
+
+.filter-options{
+ display: flex;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+ align-items: center;
+}
+
+.item {
+ margin: 5px;
+}
+
+.save-filter {
+ display: flex;
+ align-items: center;
+ min-width: 152px;
+}
+
+.save-filter > button {
+ margin: 0 10px;
+ line-height: 1.5;
+ font-size: 12px;
+ font-weight: 400;
+ color: #333;
+ background-color: #fff;
+ border-radius: 6px;
+ border-color: #ccc;
+}
+
+.save-filter > button:hover{
+ color: #333;
+ background-color: #e6e6e6;
+ border-color: #adadad;
+}
+
+.save-filter button .fa {
+ margin-right: 10px;
+}
+
+.sorting-options{
+ display: flex;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+ align-items: center;
}
\ No newline at end of file
diff --git a/src/app/pages/contacts/contacts-list/contacts-list.component.ts b/src/app/pages/contacts/contacts-list/contacts-list.component.ts
index fb63def..0694dba 100644
--- a/src/app/pages/contacts/contacts-list/contacts-list.component.ts
+++ b/src/app/pages/contacts/contacts-list/contacts-list.component.ts
@@ -14,6 +14,8 @@
export class ContactsListComponent extends BaseList {
public columnDefinition: any = CONTACTS_COLDEF;
public frameworkComponents: { setFilterComponent: any };
+ public gridApi;
+ public gridColumnApi;
constructor(public contactsSandbox: ContactsSandbox, public router: Router, protected toastr: ToastrService) {
@@ -26,6 +28,7 @@
ngOnInit() {
this.gridOptions = {
...this.gridOptions,
+ // onFilterChanged: this.sendFilterQueries.bind(this),
localeText: {
contains: 'enthält',
notContains: 'enthält nicht',
@@ -39,7 +42,57 @@
};
}
+ onGridReady(params) {
+ this.gridApi = params.api;
+ this.gridColumnApi = params.columnApi;
+
+ this.gridApi.sizeColumnsToFit();
+ }
+
public navigateTo(url) {
this.router.navigate([url]);
}
+
+ // public sendFilterQueries() {
+ // const filterQueries = this._getFilterValues();
+ // this.contactsSandbox.callSearchContacts(filterQueries);
+ // }
+
+ // private _getFilterValues(): string[] {
+ // let result = [];
+ // let filterNameString = '';
+ // let filterContactTypeString = '';
+ // let filterNoteString = '';
+ // let filterMainaddressString = '';
+ // let filterDepartmentString = '';
+
+
+ // const nameModel = this.gridApi.getFilterInstance('name').getModel();
+ // const contactTypeModel = this.gridApi.getFilterInstance('contactType').getModel();
+ // const noteModel = this.gridApi.getFilterInstance('note').getModel();
+ // const mainaddressModel = this.gridApi.getFilterInstance('mainaddress').getModel();
+ // const departmentModel = this.gridApi.getFilterInstance('department').getModel();
+
+ // if (nameModel) {
+ // filterNameString = nameModel.filter;
+ // }
+ // if (contactTypeModel) {
+ // filterContactTypeString = contactTypeModel.filter;
+ // }
+ // if (noteModel) {
+ // filterNoteString = noteModel.filter;
+ // }
+ // if (mainaddressModel) {
+ // filterMainaddressString = mainaddressModel.filter;
+ // }
+ // if (departmentModel) {
+ // filterDepartmentString = departmentModel.filter;
+ // }
+
+ // result.push(filterNameString, filterContactTypeString, filterNoteString, filterMainaddressString, filterDepartmentString)
+
+ // return result;
+ // }
+
+
}
diff --git a/src/app/pages/contacts/contacts.sandbox.ts b/src/app/pages/contacts/contacts.sandbox.ts
index 164f32e..22e2f18 100644
--- a/src/app/pages/contacts/contacts.sandbox.ts
+++ b/src/app/pages/contacts/contacts.sandbox.ts
@@ -1,3 +1,4 @@
+import { ModifyContacts } from '../../shared/models/modifyContacts.model';
import { BaseListSandbox } from '@shared/sandbox/base-list.sandbox';
import { UtilService } from '@shared/utility/utility.service';
import { Injectable, OnInit } from '@angular/core';
@@ -9,8 +10,11 @@
@Injectable()
export class ContactsSandbox extends BaseListSandbox {
- public contacts$ = this.appState$.select(store.getContactsData);
- public contactsLoading$ = this.appState$.select(store.getContactsLoading);
+
+ public sortingStatus: string = 'asc';
+ public contactProperty: string = '';
+
+ public modifyContacts = new ModifyContacts();
public serversideModel: ServerSideModel;
@@ -33,4 +37,25 @@
pageSize: this.pageSize,
};
}
+
+ // public callSearchContacts(searchQueries: string[]){
+ // console.log(searchQueries);
+ // }
+
+
+ public filterEvent() {
+ this.modifyContacts = { ...this.modifyContacts };
+ }
+
+ public sortEvent() {
+ if (this.sortingStatus && this.contactProperty){
+ const sort = this.contactProperty + ',' + this.sortingStatus;
+ this.modifyContacts.sort = sort;
+ } else {
+ this.modifyContacts.sort = null;
+ }
+
+ this.modifyContacts = { ...this.modifyContacts };
+ }
+
}
diff --git a/src/app/shared/asyncServices/http/utils.service.ts b/src/app/shared/asyncServices/http/utils.service.ts
index 1aead5d..6efc342 100644
--- a/src/app/shared/asyncServices/http/utils.service.ts
+++ b/src/app/shared/asyncServices/http/utils.service.ts
@@ -95,7 +95,7 @@
if (value instanceof Object) {
value = JSON.stringify(value);
}
- search.set(encodeURIComponent(key), encodeURIComponent(value));
+ search.set(encodeURIComponent(key), (value));
});
}
diff --git a/src/app/shared/components/paginator/paginator.component.html b/src/app/shared/components/paginator/paginator.component.html
index a9b2fb9..3d251db 100644
--- a/src/app/shared/components/paginator/paginator.component.html
+++ b/src/app/shared/components/paginator/paginator.component.html
@@ -1,6 +1,6 @@
<ul class="pagination justify-content-end">
<li class="page-item" (click)="setPreviousPage()" [ngClass]="{ disabled: isFirstPage() }"><a class="page-link">Previous</a></li>
- <li class="page-item" [ngClass]="{ active: activeEventItem?.pageIndex === pageEventItem?.pageIndex }" *ngFor="let pageEventItem of pageEventItems">
+ <li *ngFor="let pageEventItem of pageEventItems" class="page-item" [ngClass]="{ active: activeEventItem?.pageIndex === pageEventItem?.pageIndex }" >
<a class="page-link" (click)="setSelectedPage(pageEventItem)">{{ pageEventItem.pageIndex }}</a>
</li>
<li class="page-item" (click)="setNextPage()" [ngClass]="{ disabled: isLastPage() }"><a class="page-link">Next</a></li>
diff --git a/src/app/shared/components/paginator/paginator.component.ts b/src/app/shared/components/paginator/paginator.component.ts
index d4512ef..b144389 100644
--- a/src/app/shared/components/paginator/paginator.component.ts
+++ b/src/app/shared/components/paginator/paginator.component.ts
@@ -5,7 +5,7 @@
@Component({
selector: 'app-paginator',
templateUrl: './paginator.component.html',
- styleUrls: ['./paginator.component.scss'],
+ styleUrls: ['./paginator.component.scss']
})
export class PaginatorComponent implements OnInit {
@Input()
@@ -14,8 +14,20 @@
@Input()
pageSize: number;
+ private _totalPages: number;
+
@Input()
- totalPages: number;
+ public set totalPages(v: number) {
+ this._totalPages = v;
+ this.init();
+ }
+
+ public get totalPages(): number {
+ return this._totalPages;
+ }
+
+ @Input()
+ public currentPage: PageEvent;
@Input()
subscribe: number;
@@ -26,7 +38,7 @@
@Output()
page: EventEmitter<PageEvent> = new EventEmitter();
- public pageEventItems: PageEvent[] = new Array<PageEvent>();
+ public pageEventItems: PageEvent[];
public activeEventItem: PageEvent;
@@ -37,15 +49,20 @@
* @author Martin Gardyan <martin.gardyan@pta.de>
* @memberof PaginatorComponent
*/
- constructor() {}
+ constructor() { }
ngOnInit() {
- for (let index = 1; index <= this.totalPages; ++index) {
+ }
+
+ private init() {
+ this.pageEventItems = new Array<PageEvent>();
+ for (let index = 1; index <= this._totalPages; ++index) {
this.pageEventItems.push({ pageIndex: index });
}
- if (this.totalPages > 0) {
+ if (this._totalPages > 0) {
this._setActivePage(this.pageEventItems[0]);
}
+
}
public setSelectedPage(pageEvent: PageEvent): void {
diff --git a/src/app/shared/containers/card-layout/card-layout.component.scss b/src/app/shared/containers/card-layout/card-layout.component.scss
index b25f222..9db5067 100644
--- a/src/app/shared/containers/card-layout/card-layout.component.scss
+++ b/src/app/shared/containers/card-layout/card-layout.component.scss
@@ -5,6 +5,5 @@
}
.card-title {
font-size: 30px;
- margin-top: 16px;
margin-bottom: 8px;
}
diff --git a/src/app/shared/directives/agGrid/server-side.directive.ts b/src/app/shared/directives/agGrid/server-side.directive.ts
index f9cca0b..c2cff71 100644
--- a/src/app/shared/directives/agGrid/server-side.directive.ts
+++ b/src/app/shared/directives/agGrid/server-side.directive.ts
@@ -24,9 +24,28 @@
host: {},
})
export class ServerSideDirective implements OnInit {
+
+ private _queryParameter: any;
+
+ private _matPaginator: PaginatorComponent;
@Input()
public serverside: ServerSideModel;
+ @Input()
+ public set queryParameter(v: any) {
+ if (!!v) {
+ this.appState$.dispatch(
+ this.serverside.loadAction({
+ payload: {
+ queryParameter: v,
+ pageSize: this.serverside.pageSize,
+ } as PageRequestInterface,
+ }));
+ }
+ this._queryParameter = v;
+ }
+
+
/**
* Creates an instance of ServerSideDirective.
*
@@ -44,7 +63,7 @@
private _viewContainerRef: ViewContainerRef,
private _actionsSubject: ActionsSubject,
private _agGrid: AgGridAngular
- ) {}
+ ) { }
/**
* Initiates component
@@ -56,19 +75,33 @@
this._actionsSubject
.pipe(
ofType(this.serverside.successAction.type),
- take(1),
map(item => item.payload)
)
- .subscribe((pagedItem:PageModel<any>) => {
- const paginator: ComponentFactory<PaginatorComponent> = this._resolver.resolveComponentFactory(PaginatorComponent);
- const matPaginator: PaginatorComponent = this._viewContainerRef.createComponent(paginator).instance;
- matPaginator.length = pagedItem.totalElements;
- matPaginator.totalPages = pagedItem.totalPages || 1;
- matPaginator.pageSize = pagedItem.pageable.pageSize || 1;
- matPaginator.hidePageSize = false;
- matPaginator.page.subscribe((event: PageEvent) => {
- this._retrievePage(event);
+ .subscribe((pagedItem: PageModel<any>) => {
+ if (!this._matPaginator) {
+ const paginator: ComponentFactory<PaginatorComponent> = this._resolver.resolveComponentFactory(PaginatorComponent);
+ this._matPaginator = this._viewContainerRef.createComponent(paginator).instance;
+ }
+
+ this._matPaginator.length = pagedItem.totalElements;
+
+ if (this._matPaginator.totalPages != pagedItem.totalPages) {
+ this._matPaginator.totalPages = pagedItem.totalPages;
+ }
+
+ this._matPaginator.pageSize = pagedItem.pageable.pageSize || 1;
+ this._matPaginator.hidePageSize = false;
+
+ this._matPaginator.page.subscribe((selectedpage: PageEvent) => {
+ this._retrievePage(selectedpage);
});
+
+ if (!!this._agGrid.api) {
+ this._agGrid.api.setRowData(pagedItem.content)
+ } else {
+ this._agGrid.rowData = pagedItem.content;
+ }
+
});
this._retrievePage();
@@ -88,17 +121,9 @@
payload: {
pageNumber: (event && event.pageIndex) || 0,
pageSize: this.serverside.pageSize,
+ queryParameter: this._queryParameter
} as PageRequestInterface,
})
);
- this._actionsSubject
- .pipe(
- ofType(this.serverside.successAction.type),
- take(1),
- map(item => item.payload)
- )
- .subscribe(pagedItem => {
- this._agGrid.api.setRowData(pagedItem.content);
- });
}
}
diff --git a/src/app/shared/models/contact.model.ts b/src/app/shared/models/contact.model.ts
index 464e9a1..19ceeb5 100644
--- a/src/app/shared/models/contact.model.ts
+++ b/src/app/shared/models/contact.model.ts
@@ -14,6 +14,7 @@
public fkContactId: number = null;
public fkSalutationId: number = null;
public salutationType: string = null;
+ public department: string = null;
public constructor(data: any = null) {
Object.keys(data || {})
diff --git a/src/app/shared/models/modifyContacts.model.ts b/src/app/shared/models/modifyContacts.model.ts
new file mode 100644
index 0000000..f870dad
--- /dev/null
+++ b/src/app/shared/models/modifyContacts.model.ts
@@ -0,0 +1,15 @@
+import { Contact } from '@shared/models';
+
+export class ModifyContacts {
+
+ public searchText: string = null;
+ public personTypeId: string = '';
+ public sort: string = null;
+
+ public constructor(data: any = null) {
+ Object.keys(data || {})
+ .filter(property => this.hasOwnProperty(property))
+ .forEach(property => (this[property] = data[property]));
+ }
+ }
+
\ No newline at end of file
diff --git a/src/app/shared/models/page/page-request.interface.ts b/src/app/shared/models/page/page-request.interface.ts
index 6731bda..ae3c8c2 100644
--- a/src/app/shared/models/page/page-request.interface.ts
+++ b/src/app/shared/models/page/page-request.interface.ts
@@ -1,31 +1,40 @@
export interface PageRequestInterface {
- /**
- * The index number of the page requested.
- *
- * @type {number}
- * @memberof PageRequestInterface
- */
- pageNumber?: number;
- /**
- * The number of items present on a single page.
- *
- * @type {number}
- * @memberof PageRequestInterface
- */
- pageSize?: number;
- /**
- * The number of items to skip when determining the item that the first page starts with.
- *
- * @type {number}
- * @memberof PageRequestInterface
- */
- offset?: number;
-
- /**
- * Should the result be paged?
- *
- * @type {boolean}
- * @memberof PageRequestInterface
- */
- paged?: boolean;
- }
\ No newline at end of file
+
+ /**
+ * Used to define any query paramter
+ *
+ * @type {*}
+ * @memberof PageRequestInterface
+ */
+ queryParameter?: any;
+
+ /**
+ * The index number of the page requested.
+ *
+ * @type {number}
+ * @memberof PageRequestInterface
+ */
+ pageNumber?: number;
+ /**
+ * The number of items present on a single page.
+ *
+ * @type {number}
+ * @memberof PageRequestInterface
+ */
+ pageSize?: number;
+ /**
+ * The number of items to skip when determining the item that the first page starts with.
+ *
+ * @type {number}
+ * @memberof PageRequestInterface
+ */
+ offset?: number;
+
+ /**
+ * Should the result be paged?
+ *
+ * @type {boolean}
+ * @memberof PageRequestInterface
+ */
+ paged?: boolean;
+}
\ No newline at end of file
diff --git a/src/app/shared/models/server-side.model.ts b/src/app/shared/models/server-side.model.ts
index 01112e1..53dcd81 100644
--- a/src/app/shared/models/server-side.model.ts
+++ b/src/app/shared/models/server-side.model.ts
@@ -4,6 +4,7 @@
loadAction: any;
successAction?: any;
pageSize?: number;
+ filter?:any;
/**
*
*/
diff --git a/src/app/shared/store/actions/contacts.action.ts b/src/app/shared/store/actions/contacts.action.ts
index bee790b..44b3bed 100644
--- a/src/app/shared/store/actions/contacts.action.ts
+++ b/src/app/shared/store/actions/contacts.action.ts
@@ -3,17 +3,6 @@
import { PageRequestInterface } from '@shared/models/page/page-request.interface';
import { PageModel } from '@shared/models/page/page.model';
-export interface ILoadContactsSuccess {
- payload: Array<Contact>;
-}
-
-export interface ILoadContactsFail {
- payload: string;
-}
-export const loadContacts = createAction('[Contacts] Load');
-export const loadContactsSuccess = createAction('[Contacts] Load Success', props<ILoadContactsSuccess>());
-export const loadContactsFail = createAction('[Contacts] Load Fail', props<ILoadContactsFail>());
-
export interface ILoadContactsPage {
payload: PageRequestInterface;
}
diff --git a/src/app/shared/store/effects/contacts.effect.ts b/src/app/shared/store/effects/contacts.effect.ts
index 7a14299..d9443b1 100644
--- a/src/app/shared/store/effects/contacts.effect.ts
+++ b/src/app/shared/store/effects/contacts.effect.ts
@@ -25,20 +25,6 @@
@Injectable()
export class ContactsEffects {
- /**
- * Product list
- */
- getContacts$: any = createEffect(() =>
- this.actions$.pipe(
- ofType(contactsActions.loadContacts),
- switchMap(() => {
- return this.contactsApiClient.getContacts().pipe(
- map(contacts => contactsActions.loadContactsSuccess({ payload: contacts.content })),
- catchError(error => of(contactsActions.loadContactsFail({ payload: error })))
- );
- })
- )
- );
getContactsPage$: any = createEffect(() =>
this.actions$.pipe(
diff --git a/src/app/shared/store/index.ts b/src/app/shared/store/index.ts
index e7054ae..a29673d 100644
--- a/src/app/shared/store/index.ts
+++ b/src/app/shared/store/index.ts
@@ -8,7 +8,6 @@
*/
import * as fromSettings from '@shared/store/reducers/settings.reducer';
-import * as fromContacts from '@shared/store/reducers/contacts/contacts.reducer';
import * as fromContactsPage from '@shared/store/reducers/contacts/contacts-page.reducer';
/**
@@ -17,7 +16,6 @@
*/
export interface State {
settings: fromSettings.State;
- contacts: fromContacts.State;
contactsPage: fromContactsPage.State;
}
@@ -30,7 +28,6 @@
*/
export const reducers = {
settings: fromSettings.reducer,
- contacts: fromContacts.reducer,
contactsPage: fromContactsPage.reducer,
};
@@ -50,14 +47,6 @@
export const getAvailableLanguages = createSelector(getSettingsState, fromSettings.getAvailableLanguages);
/**
- * Contacts store functions
- */
-export const getContactsState = (state: State) => state.contacts;
-export const getContactsLoaded = createSelector(getContactsState, fromContacts.getLoaded);
-export const getContactsLoading = createSelector(getContactsState, fromContacts.getLoading);
-export const getContactsFailed = createSelector(getContactsState, fromContacts.getFailed);
-export const getContactsData = createSelector(getContactsState, fromContacts.getData);
-/**
* Contacts Page store functions
*/
export const getContactsPageState = (state: State) => state.contactsPage;
diff --git a/src/app/shared/store/reducers/contacts/contacts.reducer.ts b/src/app/shared/store/reducers/contacts/contacts.reducer.ts
deleted file mode 100644
index d1ca9d3..0000000
--- a/src/app/shared/store/reducers/contacts/contacts.reducer.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import * as contactsActions from '@shared/store/actions/contacts.action';
-import { Contact } from '@shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<Contact>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: []
-};
-export const ContactsReducer = createReducer(
- INITIAL_STATE,
- on(contactsActions.loadContacts, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: []
- };
- }),
- on(contactsActions.loadContactsSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload']
- };
- }),
- on(contactsActions.loadContactsFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: []
- };
- })
-);
-export function reducer(state = INITIAL_STATE, action: any): State {
- if (!action) {
- return state;
- }
-
- return ContactsReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/src/styles.scss b/src/styles.scss
index 00c3adc..71379d9 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -1359,7 +1359,7 @@
display: block;
width: 100%;
padding: 6px 12px;
- font-size: 14px;
+ font-size: 13px;
line-height: 1.25;
color: #495057;
background-color: #fff;
@@ -1389,7 +1389,7 @@
opacity: 1;
}
select.form-control:not([size]):not([multiple]) {
- height: calc(2.25rem + 2px);
+ height: calc(2.25rem + -4px);
}
select.form-control:focus::-ms-value {
color: #495057;
@@ -1467,7 +1467,7 @@
.input-group-lg > select.form-control:not([size]):not([multiple]),
.input-group-lg > select.input-group-addon:not([size]):not([multiple]),
.input-group-lg > .input-group-btn > select.btn:not([size]):not([multiple]) {
- height: calc(2.3125rem + 2px);
+ height: calc(2.3125rem + -2px);
}
.form-group {
margin-bottom: 1rem;