Skip to content
Permalink
Browse files
Merge pull request #6 from kengneruphine/develop
Extending fims-web-app to provide a UI for the Group microservice
  • Loading branch information
awasum committed Aug 2, 2018
2 parents 1a7b311 + ba6f421 commit 58252f8bdf639443dd9549ad224fe8ac00d00c83
Show file tree
Hide file tree
Showing 116 changed files with 18,292 additions and 25 deletions.

Large diffs are not rendered by default.

@@ -73,19 +73,19 @@
"codelyzer": "3.0.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.1",
"karma": "^2.0.2",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "0.2.2",
"karma-firefox-launcher": "1.0.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"license-to-fail": "2.2.0",
"phantomjs-prebuilt": "2.1.7",
"protractor": "5.1.0",
"phantomjs-prebuilt": "^2.1.16",
"protractor": "^5.3.2",
"ts-node": "3.0.6",
"tslint": "5.2.0",
"typescript": "2.3.4",
"webpack-bundle-analyzer": "^2.3.1"
"webpack-bundle-analyzer": "^2.13.1"
}
}
@@ -68,5 +68,13 @@
"pathRewrite": {
"^/api/payroll": "/payroll"
}
},

"/api/group": {
"target": "http://localhost:2032",
"secure": false,
"pathRewrite": {
"^/api/group": "/group"
}
}
}
@@ -31,7 +31,7 @@ http {
}

location /api/office/ {
proxy_pass http://localhost:2022/office/;
proxy_pass http://localhost:2023/office/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -42,7 +42,7 @@ http {
}

location /api/customer/ {
proxy_pass http://localhost:2023/customer/;
proxy_pass http://localhost:2024/customer/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -53,7 +53,7 @@ http {
}

location /api/accounting/ {
proxy_pass http://localhost:2024/accounting/;
proxy_pass http://localhost:2025/accounting/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -64,7 +64,7 @@ http {
}

location /api/portfolio/ {
proxy_pass http://localhost:2025/portfolio/;
proxy_pass http://localhost:2026/portfolio/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -75,7 +75,7 @@ http {
}

location /api/deposit/ {
proxy_pass http://localhost:2026/deposit/;
proxy_pass http://localhost:2027/deposit/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -86,7 +86,7 @@ http {
}

location /api/teller/ {
proxy_pass http://localhost:2027/teller/;
proxy_pass http://localhost:2028/teller/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -97,7 +97,40 @@ http {
}

location /api/reporting/ {
proxy_pass http://localhost:2028/reporting/;
proxy_pass http://localhost:2029/reporting/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api/cheques/ {
proxy_pass http://localhost:2030/cheques/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api/payroll/ {
proxy_pass http://localhost:2031/payroll/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api/group/ {
proxy_pass http://localhost:2032/group/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
@@ -25,6 +25,7 @@ import {HttpClient} from './services/http/http.service';
import {IdentityService} from './services/identity/identity.service';
import {OfficeService} from './services/office/office.service';
import {CustomerService} from './services/customer/customer.service';
import {GroupService} from './services/group/group.service';
import {AuthenticationService} from './services/security/authn/authentication.service';
import {CatalogService} from './services/catalog/catalog.service';
import {AccountingService} from './services/accounting/accounting.service';
@@ -40,6 +41,7 @@ import {OfficeSearchApiEffects} from './store/office/effects/service.effects';
import {EmployeeSearchApiEffects} from './store/employee/effects/service.effects';
import {RoleSearchApiEffects} from './store/role/effects/service.effects';
import {CustomerSearchApiEffects} from './store/customer/effects/service.effects';
import {GroupSearchApiEffects} from './store/group/effects/service.effects';
import {AccountSearchApiEffects} from './store/account/effects/service.effects';
import {SecurityRouteEffects} from './store/security/effects/route.effects';
import {SecurityApiEffects} from './store/security/effects/service.effects';
@@ -91,7 +93,8 @@ export function HttpLoaderFactory(http: Http) {
EffectsModule.run(CustomerSearchApiEffects),
EffectsModule.run(AccountSearchApiEffects),
EffectsModule.run(RoleSearchApiEffects),
EffectsModule.run(LedgerSearchApiEffects)
EffectsModule.run(LedgerSearchApiEffects),
EffectsModule.run(GroupSearchApiEffects)
],
providers: [
HttpClient,
@@ -100,6 +103,7 @@ export function HttpLoaderFactory(http: Http) {
IdentityService,
OfficeService,
CustomerService,
GroupService,
CatalogService,
AccountingService,
PortfolioService,
@@ -28,6 +28,7 @@ import {CommandDisplayComponent} from './command-display/command-display.compone
import {CustomerSelectComponent} from './customer-select/customer-select.component';
import {SelectListComponent} from './select-list/select-list.component';
import {EmployeeSelectComponent} from './employee-select/employee-select.component';
import {GroupSelectComponent} from './group-select/group-select.component';
import {AccountSelectComponent} from './account-select/account-select.component';
import {ProductSelectComponent} from './product-select/product-select.component';
import {TranslateModule} from '@ngx-translate/core';
@@ -15,9 +15,11 @@
limitations under the License.
-->

<mat-form-field layout-margin [formGroup]="form">
<form [formGroup]="form">
<mat-form-field layout-margin >
<input matInput type="date" [id]="controlName" [placeholder]="placeholder" [formControlName]="controlName" [title]="title"/>
<mat-error *ngIf="hasRequiredError" translate>Required</mat-error>
<mat-error *ngIf="hasBeforeTodayError" translate>Date must be before today</mat-error>
<mat-error *ngIf="hasAfterTodayError" translate>Date must be after today</mat-error>
</mat-form-field>
</form>
@@ -16,22 +16,33 @@
* specific language governing permissions and limitations
* under the License.
*/
import {Component, Input} from '@angular/core';
import {Component, Input,forwardRef} from '@angular/core';
import {FormGroup} from '@angular/forms';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';

@Component({
selector: 'fims-date-input',
templateUrl: './date-input.component.html'
templateUrl: './date-input.component.html',
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DateInputComponent),
multi: true
}
]
})
export class DateInputComponent {
export class DateInputComponent implements ControlValueAccessor {

@Input() placeholder;

@Input() controlName: string;
@Input() controlName;

@Input() form: FormGroup;

@Input() title = '';
//@Input('value') _value = false;
onChange: any = () => { };
onTouched: any = () => { };

get hasRequiredError(): boolean {
return this.hasError('required');
@@ -48,4 +59,29 @@ export class DateInputComponent {
hasError(key: string): boolean {
return this.form.get(this.controlName).hasError(key);
}
get value() {
return this.controlName;
}

set value(val) {
this.controlName= val;
this.onChange(val);
this.onTouched();
}

constructor() { }

registerOnChange(fn) {
this.onChange = fn;
}

registerOnTouched(fn) {
this.onTouched = fn;
}

writeValue(controlName) {
if (controlName) {
this.controlName = controlName;
}
}
}
@@ -0,0 +1,31 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<div layout="row">
<mat-form-field layout-margin flex>
<input matInput [placeholder]="title" [matAutocomplete]="auto" [formControl]="formControl">
<mat-hint class="tc-red-600">
<ng-content></ng-content>
</mat-hint>
</mat-form-field>
</div>

<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let group of groups | async" [value]="group.identifier">
{{ group.identifier }}
</mat-option>
</mat-autocomplete>
@@ -0,0 +1,94 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import {Component, forwardRef, Input, OnInit} from '@angular/core';
import {FetchRequest} from '../../services/domain/paging/fetch-request.model';
import {Observable} from 'rxjs/Observable';
import {ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR} from '@angular/forms';
import {Group} from '../../services/group/domain/group.model';
import {GroupService} from '../../services/group/group.service';
import {GroupPage} from '../../services/group/domain/group-page.model';

const noop: () => void = () => {
// empty method
};

@Component({
providers: [
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GroupSelectComponent), multi: true }
],
selector: 'fims-group-select',
templateUrl: './group-select.component.html'
})
export class GroupSelectComponent implements ControlValueAccessor, OnInit {

formControl: FormControl;

@Input() title: string;

@Input() required: boolean;

groups: Observable<Group[]>;

private _onTouchedCallback: () => void = noop;

private _onChangeCallback: (_: any) => void = noop;

constructor(private groupService: GroupService) {}

ngOnInit(): void {
this.formControl = new FormControl('');

this.groups = this.formControl.valueChanges
.distinctUntilChanged()
.debounceTime(500)
.do(name => this.changeValue(name))
.filter(name => name)
.switchMap(name => this.onSearch(name));
}

changeValue(value: string): void {
this._onChangeCallback(value);
}

writeValue(value: any): void {
this.formControl.setValue(value);
}

registerOnChange(fn: any): void {
this._onChangeCallback = fn;
}

registerOnTouched(fn: any): void {
this._onTouchedCallback = fn;
}

onSearch(searchTerm?: string): Observable<Group[]> {
const fetchRequest: FetchRequest = {
page: {
pageIndex: 0,
size: 5
},
searchTerm
};

return this.groupService.fetchGroups(fetchRequest)
.map((groupPage: GroupPage) => groupPage.groups);
}

}
@@ -32,7 +32,7 @@ export class NumberInputComponent {

@Input() form: FormGroup;

@Input() requireDecimal = true;
@Input() requireDecimal = false;

@Input() decimalLimit = 2;

0 comments on commit 58252f8

Please sign in to comment.