committed by
Jivjyot Singh
parent
df12a6b4ba
commit
24dd42ec37
@@ -58,7 +58,7 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[row.id]" class="select-row"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/**
|
||||
* Adhoc Query data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdhocQueryResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService) {}
|
||||
|
||||
/**
|
||||
* Returns the adhoc query data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const adhocQueryId = route.paramMap.get('id');
|
||||
return this.organizationService.getAdhocQuery(adhocQueryId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="edit"></fa-icon>
|
||||
Edit
|
||||
</button>
|
||||
<button mat-raised-button color="warn" (click)="deleteAdhocQuery()">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Name
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ adhocQueryData.name }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Query
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ adhocQueryData.query }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Table Affected
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ adhocQueryData.tableName }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong" *ngIf="adhocQueryData.reportRunFrequency">
|
||||
Report Run Frequency
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" *ngIf="adhocQueryData.reportRunFrequency">
|
||||
{{ adhocQueryData.reportRunFrequency }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Status
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ adhocQueryData.isActive === true ? 'Active' : 'Inactive' }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Created By
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ adhocQueryData.createdBy }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewAdhocQueryComponent } from './view-adhoc-query.component';
|
||||
|
||||
describe('ViewAdhocQueryComponent', () => {
|
||||
let component: ViewAdhocQueryComponent;
|
||||
let fixture: ComponentFixture<ViewAdhocQueryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewAdhocQueryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewAdhocQueryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/**
|
||||
* View Adhoc Query Component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-view-adhoc-query',
|
||||
templateUrl: './view-adhoc-query.component.html',
|
||||
styleUrls: ['./view-adhoc-query.component.scss']
|
||||
})
|
||||
export class ViewAdhocQueryComponent implements OnInit {
|
||||
|
||||
/** Adhoc query data. */
|
||||
adhocQueryData: any;
|
||||
|
||||
/**
|
||||
* Retrieves the adhoc query data from `resolve`.
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog) {
|
||||
this.route.data.subscribe((data: { adhocQuery: any }) => {
|
||||
this.adhocQueryData = data.adhocQuery;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the adhoc query and redirects to adhoc queries.
|
||||
*/
|
||||
deleteAdhocQuery() {
|
||||
const deleteAdhocQueryDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `adhoc query ${this.adhocQueryData.id}` }
|
||||
});
|
||||
deleteAdhocQueryDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteAdhocQuery(this.adhocQueryData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/organization/adhoc-query']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { ViewEmployeeComponent } from './employees/view-employee/view-employee.c
|
||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { ViewAdhocQueryComponent } from './adhoc-query/view-adhoc-query/view-adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
import { PaymentTypesComponent } from './payment-types/payment-types.component';
|
||||
import { PasswordPreferencesComponent } from './password-preferences/password-preferences.component';
|
||||
@@ -34,6 +35,7 @@ import { EmployeeResolver } from './employees/employee.resolver';
|
||||
import { CurrenciesResolver } from './currencies/currencies.resolver';
|
||||
import { SmsCampaignsResolver } from './sms-campaigns/sms-campaigns.resolver';
|
||||
import { AdhocQueriesResolver } from './adhoc-query/adhoc-queries.resolver';
|
||||
import { AdhocQueryResolver } from './adhoc-query/adhoc-query.resolver';
|
||||
import { TellersResolver } from './tellers/tellers.resolver';
|
||||
import { PaymentTypesResolver } from './payment-types/payment-types.resolver';
|
||||
import { PasswordPreferencesTemplateResolver } from './password-preferences/password-preferences-template.resolver';
|
||||
@@ -135,6 +137,14 @@ const routes: Routes = [
|
||||
resolve: {
|
||||
adhocQueries: AdhocQueriesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ViewAdhocQueryComponent,
|
||||
data: { title: extract('View Adhoc Query'), routeResolveBreadcrumb: ['adhocQuery', 'name']},
|
||||
resolve: {
|
||||
adhocQuery: AdhocQueryResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -209,6 +219,7 @@ const routes: Routes = [
|
||||
CurrenciesResolver,
|
||||
SmsCampaignsResolver,
|
||||
AdhocQueriesResolver,
|
||||
AdhocQueryResolver,
|
||||
TellersResolver,
|
||||
PaymentTypesResolver,
|
||||
PasswordPreferencesTemplateResolver,
|
||||
|
||||
@@ -14,6 +14,7 @@ import { EmployeesComponent } from './employees/employees.component';
|
||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { ViewAdhocQueryComponent } from './adhoc-query/view-adhoc-query/view-adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
import { PaymentTypesComponent } from './payment-types/payment-types.component';
|
||||
import { PasswordPreferencesComponent } from './password-preferences/password-preferences.component';
|
||||
@@ -43,6 +44,7 @@ import { ViewEmployeeComponent } from './employees/view-employee/view-employee.c
|
||||
CurrenciesComponent,
|
||||
SmsCampaignsComponent,
|
||||
AdhocQueryComponent,
|
||||
ViewAdhocQueryComponent,
|
||||
TellersComponent,
|
||||
PaymentTypesComponent,
|
||||
PasswordPreferencesComponent,
|
||||
|
||||
@@ -84,6 +84,22 @@ export class OrganizationService {
|
||||
return this.http.get('/adhocquery');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} adhocQueryId Adhoc Query ID of adhoc query.
|
||||
* @returns {Observable<any>} Adhoc query.
|
||||
*/
|
||||
getAdhocQuery(adhocQueryId: string): Observable<any> {
|
||||
return this.http.get(`/adhocquery/${adhocQueryId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} adhocQueryId Adhoc Query ID of adhoc query to be deleted.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteAdhocQuery(adhocQueryId: string): Observable<any> {
|
||||
return this.http.delete(`/adhocquery/${adhocQueryId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Tellers data
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user