Skip to content
Open
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
@@ -0,0 +1,24 @@
import {
ApiService,
IAdapter,
PatchAPICommand,
PostAPICommand,
} from '@project-lib/core/api';

import {Inject} from '@angular/core';
import {APP_CONFIG} from '@project-lib/app-config';
import {IAnyObject} from '@project-lib/core/i-any-object';
export class ResendEmailByLeadIdCommand<T> extends PostAPICommand<T> {
constructor(
apiService: ApiService,
adapter: IAdapter<T>,
leadId: string,
appConfig: IAnyObject,
) {
super(
apiService,
adapter,
`${appConfig.baseApiUrl}${appConfig.tenantMgmtFacadeUrl}/leads/${leadId}/reminder`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {OnBoardingService} from '../../../shared/services/on-boarding-service';
import {Lead} from '../../../shared/models';
import {AnyObject, BackendFilter, Count} from '@project-lib/core/index';
import {HttpClient} from '@angular/common/http';
import {ResendReminderButtonComponent} from '../resend-reminder-button/resend-reminder-button.component';

@Component({
selector: 'app-lead',
Expand All @@ -33,6 +34,12 @@ export class LeadListComponent extends RouteComponentBaseDirective {
{field: 'companyName', width: 250, minWidth: 20},
{field: 'email', width: 300, minWidth: 20},
{field: 'country', width: 250, minWidth: 20},
{
field: 'actions',
headerName: 'Actions',
cellRenderer: ResendReminderButtonComponent,
width: 200,
},
];

rowData = [];
Expand Down Expand Up @@ -93,6 +100,7 @@ export class LeadListComponent extends RouteComponentBaseDirective {
return this.onboardingService.getLeadList(filter).pipe(
map(res => {
const rows = res.map(item => ({
id: item.id,
firstName: item.firstName,
lastName: item.lastName,
companyName: item.companyName,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="btns">
<nb-icon
class="email-icon"
icon="email-outline"
pack="eva"
status="success"
size="large"
(click)="resendEmail($event)"
></nb-icon>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.email-icon {
color: #ef0b16;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ResendReminderButtonComponent } from './resend-reminder-button.component';

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

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

fixture = TestBed.createComponent(ResendReminderButtonComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {Component} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {AnyObject} from '@project-lib/core/api';
import {ToasterService} from '@project-lib/theme/toaster';
import {ICellRendererAngularComp} from 'ag-grid-angular';
import {GridApi, ICellRendererParams} from 'ag-grid-community';
import {BillingPlanService, OnBoardingService} from '../../../shared/services';
import {Location} from '@angular/common';

@Component({
selector: 'app-resend-reminder-button',
templateUrl: './resend-reminder-button.component.html',
styleUrls: ['./resend-reminder-button.component.scss'],
})
export class ResendReminderButtonComponent implements ICellRendererAngularComp {
params: AnyObject;
gridApi: GridApi;

constructor(
private router: Router,
private toastrService: ToasterService,
private billingPlanService: BillingPlanService,
private location: Location,
private route: ActivatedRoute,
private readonly onBoardingService: OnBoardingService,
) {}
refresh(params: ICellRendererParams) {
return true;
}

agInit(params: ICellRendererParams): void {
this.params = params;
}
resendEmail(e) {
// const rowDataId = this.route.snapshot.paramMap.get('id')!;
const rowDataId = this.params.node.data.id;
console.log(rowDataId);
this.onBoardingService
.resendValidateEmail(rowDataId)
.subscribe(respLead => {
console.log(respLead);
});
this.toastrService.show('The email has been sent successfully.');
}
onGridReady(params) {
this.gridApi = params.api;
}
}
2 changes: 2 additions & 0 deletions projects/saas-ui/src/app/main/main.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {ButtonRendererComponent} from './components/button-renderer/button-rende
import {TenantRegistrationComponent} from './components/tenant-registration/tenant-registration.component';
import { TenantDetailComponent } from './components/tenant-detail/tenant-detail.component';
import { EyeIconRendererComponent } from './components/eye-icon-renderer/eye-icon-renderer.component';
import { ResendReminderButtonComponent } from './components/resend-reminder-button/resend-reminder-button.component';

@NgModule({
declarations: [
Expand All @@ -35,6 +36,7 @@ import { EyeIconRendererComponent } from './components/eye-icon-renderer/eye-ico
TenantRegistrationComponent,
TenantDetailComponent,
EyeIconRendererComponent,
ResendReminderButtonComponent,
],
imports: [
CommonModule,
Expand Down
16 changes: 16 additions & 0 deletions projects/saas-ui/src/app/shared/services/on-boarding-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {GetTotalLeadCommand} from '../../main/commands/get-total-lead.command';

import {TenantLead} from '../models/tenantLead.model';
import {RegisterTenantCommand} from '../../main/commands/register-tenant.command';
import {ResendEmailByLeadIdCommand} from '../../main/commands/resend-email-by-leadid.command';

interface BackendFilter<MT extends object = AnyObject> {
where?: Where<MT>;
Expand Down Expand Up @@ -66,6 +67,21 @@ export class OnBoardingService {
return command.execute();
}

public resendValidateEmail(leadId: string) {
const command: ResendEmailByLeadIdCommand<{leadId: string}> =
new ResendEmailByLeadIdCommand(
this.apiService,
this.anyAdapter,
leadId,
this.appConfig,
);
// sonarignore:end
command.parameters = {
data: {},
};
return command.execute();
}

getLeadDetails(leadId: string): Observable<Lead> {
const command: GetLeadByIdCommand<Lead> = new GetLeadByIdCommand(
this.apiService,
Expand Down