@@ -14,12 +14,14 @@ import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/
|
|||||||
import { OfficesComponent } from './offices/offices.component';
|
import { OfficesComponent } from './offices/offices.component';
|
||||||
import { EmployeesComponent } from './employees/employees.component';
|
import { EmployeesComponent } from './employees/employees.component';
|
||||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||||
|
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
||||||
import { OfficesResolver } from './offices/offices.resolver';
|
import { OfficesResolver } from './offices/offices.resolver';
|
||||||
import { EmployeesResolver } from './employees/employees.resolver';
|
import { EmployeesResolver } from './employees/employees.resolver';
|
||||||
import { CurrenciesResolver } from './currencies/currencies.resolver';
|
import { CurrenciesResolver } from './currencies/currencies.resolver';
|
||||||
|
import { SmsCampaignsResolver } from './sms-campaigns/sms-campaigns.resolver';
|
||||||
|
|
||||||
/** Organization Routes */
|
/** Organization Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -63,6 +65,14 @@ const routes: Routes = [
|
|||||||
resolve: {
|
resolve: {
|
||||||
currencies: CurrenciesResolver
|
currencies: CurrenciesResolver
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'sms-campaigns',
|
||||||
|
component: SmsCampaignsComponent,
|
||||||
|
data: { title: extract('SMS Campaigns'), breadcrumb: 'SMS Campaigns' },
|
||||||
|
resolve: {
|
||||||
|
smsCampaigns: SmsCampaignsResolver
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -81,7 +91,8 @@ const routes: Routes = [
|
|||||||
LoanProvisioningCriteriaResolver,
|
LoanProvisioningCriteriaResolver,
|
||||||
OfficesResolver,
|
OfficesResolver,
|
||||||
EmployeesResolver,
|
EmployeesResolver,
|
||||||
CurrenciesResolver
|
CurrenciesResolver,
|
||||||
|
SmsCampaignsResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationRoutingModule { }
|
export class OrganizationRoutingModule { }
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
<p matLine>Manage payment types</p>
|
<p matLine>Manage payment types</p>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['sms-campaigns']">
|
||||||
<mat-icon matListIcon>
|
<mat-icon matListIcon>
|
||||||
<fa-icon icon="envelope" size="sm"></fa-icon>
|
<fa-icon icon="envelope" size="sm"></fa-icon>
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { NgModule } from '@angular/core';
|
|||||||
/** Custom Modules */
|
/** Custom Modules */
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { OrganizationRoutingModule } from './organization-routing.module';
|
import { OrganizationRoutingModule } from './organization-routing.module';
|
||||||
|
import { PipesModule } from 'app/pipes/pipes.module';
|
||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { OrganizationComponent } from './organization.component';
|
import { OrganizationComponent } from './organization.component';
|
||||||
@@ -11,6 +12,7 @@ import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/
|
|||||||
import { OfficesComponent } from './offices/offices.component';
|
import { OfficesComponent } from './offices/offices.component';
|
||||||
import { EmployeesComponent } from './employees/employees.component';
|
import { EmployeesComponent } from './employees/employees.component';
|
||||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||||
|
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organization Module
|
* Organization Module
|
||||||
@@ -20,14 +22,16 @@ import { CurrenciesComponent } from './currencies/currencies.component';
|
|||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
OrganizationRoutingModule
|
OrganizationRoutingModule,
|
||||||
|
PipesModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OrganizationComponent,
|
OrganizationComponent,
|
||||||
LoanProvisioningCriteriaComponent,
|
LoanProvisioningCriteriaComponent,
|
||||||
OfficesComponent,
|
OfficesComponent,
|
||||||
EmployeesComponent,
|
EmployeesComponent,
|
||||||
CurrenciesComponent
|
CurrenciesComponent,
|
||||||
|
SmsCampaignsComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationModule { }
|
export class OrganizationModule { }
|
||||||
|
|||||||
@@ -46,4 +46,11 @@ export class OrganizationService {
|
|||||||
return this.http.get('/currencies');
|
return this.http.get('/currencies');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} SMS Campaigns data
|
||||||
|
*/
|
||||||
|
getSmsCampaigns(): Observable<any> {
|
||||||
|
return this.http.get('/smscampaigns');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Create SMS Campaign
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div fxLayout="row" fxLayoutGap="20px">
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Filter</mat-label>
|
||||||
|
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mat-elevation-z8">
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="campaignName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign"> {{ smsCampaign.campaignName }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="campaignMessage">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Template Message </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign"> {{ smsCampaign.campaignMessage }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="campaignType.value">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Campaign Type </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign"> {{ smsCampaign.campaignType.value }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="triggerType.value">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Trigger Type </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign"> {{ smsCampaign.triggerType.value }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="campaignStatus.value">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign">
|
||||||
|
<div [className]="smsCampaign.campaignStatus.code | statusLookup">
|
||||||
|
<fa-icon matTooltip="{{ smsCampaign.campaignStatus.value | titlecase }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="smsCampaignTimeLine.submittedByUsername">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Approved By </th>
|
||||||
|
<td mat-cell *matCellDef="let smsCampaign"> {{ smsCampaign.smsCampaignTimeLine.submittedByUsername }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.select-row:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { SmsCampaignsComponent } from './sms-campaigns.component';
|
||||||
|
|
||||||
|
describe('SmsCampaignsComponent', () => {
|
||||||
|
let component: SmsCampaignsComponent;
|
||||||
|
let fixture: ComponentFixture<SmsCampaignsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ SmsCampaignsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(SmsCampaignsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS Campaigns component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-sms-campaigns',
|
||||||
|
templateUrl: './sms-campaigns.component.html',
|
||||||
|
styleUrls: ['./sms-campaigns.component.scss']
|
||||||
|
})
|
||||||
|
export class SmsCampaignsComponent implements OnInit {
|
||||||
|
|
||||||
|
/** SMS Campaigns data. */
|
||||||
|
smsCampaignsData: any;
|
||||||
|
/** Columns to be displayed in sms campaigns table. */
|
||||||
|
displayedColumns: string[] = ['campaignName', 'campaignMessage', 'campaignType.value', 'triggerType.value', 'campaignStatus.value', 'smsCampaignTimeLine.submittedByUsername'];
|
||||||
|
/** Data source for SMS campaigns table. */
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
/** Paginator for SMS campaigns table. */
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
/** Sorter for SMS campaigns table. */
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the SMS campaigns data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe(( data: { smsCampaigns: any }) => {
|
||||||
|
this.smsCampaignsData = data.smsCampaigns.pageItems;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters data in SMS campaigns table based on passed value.
|
||||||
|
* @param {string} filterValue Value to filter data.
|
||||||
|
*/
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the SMS campaigns table.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.setSmsCampaigns();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the data source, paginator and sorter for SMS campaigns table.
|
||||||
|
*/
|
||||||
|
setSmsCampaigns() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.smsCampaignsData);
|
||||||
|
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||||
|
switch (property) {
|
||||||
|
case 'campaignType.value': return item.campaignType.value;
|
||||||
|
case 'triggerType.value': return item.triggerType.value;
|
||||||
|
case 'campaignStatus.value': return item.campaignStatus.value;
|
||||||
|
case 'smsCampaignTimeLine.submittedByUsername': return item.smsCampaignTimeLine.submittedByUsername;
|
||||||
|
default: return item[property];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { OrganizationService } from '../organization.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS Campaigns data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class SmsCampaignsResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OrganizationService} organizationService Organization service.
|
||||||
|
*/
|
||||||
|
constructor(private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SMS Campaigns data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.organizationService.getSmsCampaigns();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -35,7 +35,10 @@ export class StatusLookupPipe implements PipeTransform {
|
|||||||
'clientStatusType.submitted.and.pending.approval': 'status-pending',
|
'clientStatusType.submitted.and.pending.approval': 'status-pending',
|
||||||
'clientStatusTYpe.approved': 'status-approved',
|
'clientStatusTYpe.approved': 'status-approved',
|
||||||
'clientStatusType.transfer.in.progress': 'status-transfer-progress', // write
|
'clientStatusType.transfer.in.progress': 'status-transfer-progress', // write
|
||||||
'clientStatusType.transfer.on.hold': 'status-transfer-hold' // write
|
'clientStatusType.transfer.on.hold': 'status-transfer-hold', // write
|
||||||
|
'smsCampaignStatus.active': 'status-active',
|
||||||
|
'smsCampaignStatus.pending': 'status-pending',
|
||||||
|
'smsCampaignStatus.closed': 'status-closed',
|
||||||
};
|
};
|
||||||
return cssClassNameLookup[status];
|
return cssClassNameLookup[status];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user