Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Deposit and Recurring Deposit products with datatables #1647

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

<mat-form-field *ngIf="createClientForm.contains('activationDate')" fxFlex="48%" (click)="activatedOnDatePicker.open()">
<mat-label>Activation Date</mat-label>
<input matInput [min]="minDate" [max]="createClientForm.value.submittedOnDate" [matDatepicker]="activatedOnDatePicker" required
<input matInput [min]="createClientForm.value.submittedOnDate" [max]="createClientForm.value.submittedOnDate" [matDatepicker]="activatedOnDatePicker" required
formControlName="activationDate">
<mat-datepicker-toggle matSuffix [for]="activatedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #activatedOnDatePicker></mat-datepicker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<mat-card-content>

<div class="share-account-tables" fxLayout="row wrap" fxFlex="50%" class="p-t-20">
<div class="share-account-tables p-t-20" fxLayout="row wrap" fxFlex="50%">

<table>

Expand Down
2 changes: 1 addition & 1 deletion src/app/core/http/error-handler.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
} else if (status === 403 && errorMessage === 'The provided one time token is invalid') {
this.alertService.alert({ type: 'Invalid Token', message: 'Invalid Token. Please try again!' });
} else if (status === 400) {
this.alertService.alert({ type: 'Bad Request', message: 'Invalid parameters were passed in the request!' });
this.alertService.alert({ type: 'Bad Request', message: errorMessage || 'Invalid parameters were passed in the request!' });
} else if (status === 403) {
this.alertService.alert({ type: 'Unauthorized Request', message: errorMessage || 'You are not authorized for this request!' });
} else if (status === 404) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/groups/common-resolvers/group-actions.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class GroupActionsResolver implements Resolve<Object> {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const actionName = route.paramMap.get('action');
const groupId = route.paramMap.get('groupId') || route.parent.parent.paramMap.get('groupId');
switch (actionName) {
case 'Attendance':
Expand Down
30 changes: 15 additions & 15 deletions src/app/groups/create-group/create-group.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,23 @@
</mat-select>
</mat-form-field>

<mat-form-field (click)="submittedOnDatePicker.open()">
<mat-label>Submitted on</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" required formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedOnDatePicker></mat-datepicker>
<mat-error *ngIf="groupForm.controls.submittedOnDate.hasError('required')">
Submission Date is <strong>required</strong>
</mat-error>
</mat-form-field>

<mat-checkbox labelPosition="before" formControlName="active">
Active
</mat-checkbox>

<mat-form-field *ngIf="this.groupForm.controls.active.value" (click)="activationDatePicker.open()">
<mat-form-field *ngIf="groupForm.controls.active.value" (click)="activationDatePicker.open()">
<mat-label>Activation Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="activationDatePicker" required formControlName="activationDate">
<input matInput [min]="groupForm.value.submittedOnDate" [max]="maxDate" [matDatepicker]="activationDatePicker" required formControlName="activationDate">
<mat-datepicker-toggle matSuffix [for]="activationDatePicker"></mat-datepicker-toggle>
<mat-datepicker #activationDatePicker></mat-datepicker>
<mat-error *ngIf="groupForm.controls.activationDate.hasError('required')">
Expand All @@ -59,21 +69,11 @@
<input matInput formControlName="externalId">
</mat-form-field>

<mat-form-field (click)="submittedOnDatePicker.open()">
<mat-label>Submitted on</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" required formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedOnDatePicker></mat-datepicker>
<mat-error *ngIf="groupForm.controls.submittedOnDate.hasError('required')">
Submission Date is <strong>required</strong>
</mat-error>
</mat-form-field>

<mat-form-field>
<mat-label>Add Clients</mat-label>
<input matInput [formControl]="clientChoice" [matAutocomplete]="clientsAutocomplete">
</mat-form-field>

</div>

<mat-autocomplete autoActiveFirstOption #clientsAutocomplete="matAutocomplete" [displayWith]="displayClient">
Expand Down Expand Up @@ -108,10 +108,10 @@
<mat-nav-list *ngIf="clientMembers.length">
<h3 matSubheader>Selected Clients</h3>
<div mat-list-item *ngFor="let client of clientMembers index as i">
<button mat-icon-button (click)="removeClient(i)">
<span matLine>{{client.displayName}}</span>
<button mat-icon-button color="warn" (click)="removeClient(i)">
<fa-icon icon="trash"></fa-icon>
</button>
<span matLine>{{client.displayName}}</span>
</div>
</mat-nav-list>

Expand Down
2 changes: 1 addition & 1 deletion src/app/groups/create-group/create-group.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.container {
max-width: 37rem;
max-width: 50rem;
}

.mat-table {
Expand Down
4 changes: 2 additions & 2 deletions src/app/groups/create-group/create-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
this.groupForm = this.formBuilder.group({
'name': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
'officeId': ['', Validators.required],
'submittedOnDate': ['', Validators.required],
'submittedOnDate': [this.settingsService.businessDate, Validators.required],
'staffId': [''],
'externalId': [''],
'active': [false],
Expand Down Expand Up @@ -169,7 +169,7 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
data.clientMembers = [];
this.clientMembers.forEach((client: any) => data.clientMembers.push(client.id));
this.groupService.createGroup(data).subscribe((response: any) => {
this.router.navigate(['../groups']);
this.router.navigate(['../groups', response.resourceId, 'general']);
});
}

Expand Down
22 changes: 11 additions & 11 deletions src/app/groups/edit-group/edit-group.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,19 @@
</mat-select>
</mat-form-field>

<mat-form-field (click)="submittedOnDatePicker.open()">
<mat-label>Submitted on</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" required formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedOnDatePicker></mat-datepicker>
<mat-error *ngIf="editGroupForm.controls.submittedOnDate.hasError('required')">
Submission Date is <strong>required</strong>
</mat-error>
</mat-form-field>

<mat-form-field *ngIf="this.editGroupForm.contains('activationDate')" (click)="activationDatePicker.open()">
<mat-label>Activation Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="activationDatePicker" required formControlName="activationDate">
<input matInput [min]="editGroupForm.value.submittedOnDate" [max]="maxDate" [matDatepicker]="activationDatePicker" required formControlName="activationDate">
<mat-datepicker-toggle matSuffix [for]="activationDatePicker"></mat-datepicker-toggle>
<mat-datepicker #activationDatePicker></mat-datepicker>
<mat-error *ngIf="editGroupForm.controls.activationDate.hasError('required')">
Expand All @@ -43,16 +53,6 @@
<input matInput formControlName="externalId">
</mat-form-field>

<mat-form-field (click)="submittedOnDatePicker.open()">
<mat-label>Submitted on</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker" required formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedOnDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedOnDatePicker></mat-datepicker>
<mat-error *ngIf="editGroupForm.controls.submittedOnDate.hasError('required')">
Submission Date is <strong>required</strong>
</mat-error>
</mat-form-field>

</div>

</mat-card-content>
Expand Down
2 changes: 1 addition & 1 deletion src/app/groups/edit-group/edit-group.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.container {
max-width: 37rem;
max-width: 50rem;
}
9 changes: 7 additions & 2 deletions src/app/groups/groups-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ const routes: Routes = [
groupDatatables: GroupDatatablesResolver
},
children: [
{
path: '',
redirectTo: 'general',
pathMatch: 'full'
},
{
path: 'general',
component: GeneralTabComponent,
Expand Down Expand Up @@ -133,8 +138,8 @@ const routes: Routes = [
]
},
{
path: 'actions/:name',
data: { title: extract('Group Actions'), routeParamBreadcrumb: 'name' },
path: 'actions/:action',
data: { title: extract('Group Actions'), breadcrumb: 'action', routeParamBreadcrumb: 'action' },
component: GroupActionsComponent,
resolve: {
groupActionData: GroupActionsResolver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AttachGroupMeetingComponent implements OnInit {
}

ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.maxDate = this.settingsService.maxFutureDate;
this.createGroupMeetingForm();
this.buildDependencies();
}
Expand Down Expand Up @@ -119,7 +119,7 @@ export class AttachGroupMeetingComponent implements OnInit {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const title = `groups_${this.groupId}_CollectionMeeting`;
const typeId = '1';
const typeId = groupMeetingFormData.repeating ? '1' : '4' ;
const prevStartDate: Date = this.groupMeetingForm.value.startDate;
if (groupMeetingFormData.startDate instanceof Date) {
groupMeetingFormData.startDate = this.dateUtils.formatDate(prevStartDate, dateFormat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class GroupActionsComponent {
constructor(private route: ActivatedRoute,
private router: Router) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
const action = this.route.snapshot.params['action'];
this.actions[action] = true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,24 @@

</mat-card>

<mat-card fxFlex="40%">
<mat-card fxFlex="50%">

<h3 matSubheader>Client Members</h3>

<mat-nav-list *ngIf="clientMembers?.length">
<div mat-list-item *ngFor="let client of clientMembers index as i">
<span matLine class="p-t-10">{{client.displayName}}</span>
<div fxFlex></div>
<button mat-icon-button color="warn" (click)="removeClient(i, client)">
<button mat-icon-button color="warn" (click)="removeClient(i, client)" matTooltip="Remove Client from Group" matTooltipPosition="left">
<fa-icon icon="trash"></fa-icon>
</button>
</div>
</mat-nav-list>

</mat-card>

<div fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../']">Back</button>
</div>

</div>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.container {
max-width: 50rem;
max-width: 70rem;

.mat-table {
display: block;
font-family: Tahoma, Verdana;
width: 100%;
}

.mat-row,
.mat-header-row {
display: flex;
Expand All @@ -16,14 +16,14 @@
min-height: 48px;
padding: 0 24px;
}

.mat-cell,
.mat-header-cell {
flex: 1;
overflow: hidden;
word-wrap: break-word;
}

h3 {
padding-left: 0;
margin-bottom: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ManageGroupMembersComponent implements AfterViewInit {
public dialog: MatDialog) {
this.route.data.subscribe((data: { groupActionData: any }) => {
this.groupData = data.groupActionData;
this.clientMembers = data.groupActionData.clientMembers;
this.clientMembers = data.groupActionData.clientMembers || [];
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/groups/groups-view/groups-view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h3 fxFlex="95%">
</mat-icon>
<span>Edit</span>
</button>
<button mat-menu-item *mifosxHasPermission="'CREATE_CLIENT'">
<button mat-menu-item *mifosxHasPermission="'CREATE_CLIENT'" (click)="doAction('Manage Members')">
<mat-icon matListIcon>
<fa-icon icon="plus" size="sm"></fa-icon>
</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import { ProductsService } from '../../products.service';
@Injectable()
export class FixedDepositProductAndTemplateResolver implements Resolve<Object> {

/**
* @param {ProductsService} productsService Products service.
*/
constructor(private productsService: ProductsService) { }
/**
* @param {ProductsService} productsService Products service.
*/
constructor(private productsService: ProductsService) { }

/**
* Returns the Fixed Deposits Product and Template.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const fixedDepositProductId = route.paramMap.get('id');
return this.productsService.getFixedDepositProductAndTemplate(fixedDepositProductId);
}
/**
* Returns the Fixed Deposits Product and Template.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const productId = route.parent.paramMap.get('productId');
return this.productsService.getFixedDepositProductAndTemplate(productId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class FixedDepositProductResolver implements Resolve<Object> {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const fixedDepositProductId = route.paramMap.get('id');
return this.productsService.getFixedDepositProduct(fixedDepositProductId);
const productId = route.parent.paramMap.get('productId');
return this.productsService.getFixedDepositProduct(productId);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="tab-container mat-typography">
<mifosx-entity-datatable-tab
entityType="Fixed Deposit Product"
[entityId]="entityId"
[multiRowDatatableFlag]="multiRowDatatableFlag"
[entityDatatable]="entityDatatable"
>
</mifosx-entity-datatable-tab>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FixedDepositDatatableTabComponent } from './fixed-deposit-datatable-tab.component';

describe('FixedDepositDatatableTabComponent', () => {
let component: FixedDepositDatatableTabComponent;
let fixture: ComponentFixture<FixedDepositDatatableTabComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FixedDepositDatatableTabComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(FixedDepositDatatableTabComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading