@@ -45,6 +45,7 @@
|
|||||||
<button mat-menu-item (click)="doAction('Close')">Close</button>
|
<button mat-menu-item (click)="doAction('Close')">Close</button>
|
||||||
<button mat-menu-item (click)="doAction('Survey')"> Survey</button>
|
<button mat-menu-item (click)="doAction('Survey')"> Survey</button>
|
||||||
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Reject')">Reject</button></span>
|
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Reject')">Reject</button></span>
|
||||||
|
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Delete')">Delete</button></span>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { MatDialog } from '@angular/material';
|
|||||||
|
|
||||||
/** Custom Dialogs */
|
/** Custom Dialogs */
|
||||||
import { UnassignStaffDialogComponent } from './custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component';
|
import { UnassignStaffDialogComponent } from './custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component';
|
||||||
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { ClientsService } from '../clients.service';
|
import { ClientsService } from '../clients.service';
|
||||||
@@ -59,6 +60,8 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
case 'Unassign Staff':
|
case 'Unassign Staff':
|
||||||
this.unassignStaff();
|
this.unassignStaff();
|
||||||
break;
|
break;
|
||||||
|
case 'Delete':
|
||||||
|
this.deleteClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +77,23 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unassign's the group's staff.
|
* Deletes the client
|
||||||
|
*/
|
||||||
|
private deleteClient() {
|
||||||
|
const deleteClientDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||||
|
data: { deleteContext: `client with id: ${this.clientViewData.id}` }
|
||||||
|
});
|
||||||
|
deleteClientDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response.delete) {
|
||||||
|
this.clientsService.deleteClient(this.clientViewData.id).subscribe(() => {
|
||||||
|
this.router.navigate(['/clients'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unassign's the client's staff.
|
||||||
*/
|
*/
|
||||||
private unassignStaff() {
|
private unassignStaff() {
|
||||||
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
|
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/${clientId}`);
|
return this.http.get(`/clients/${clientId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteClient(clientId: string) {
|
||||||
|
return this.http.delete(`/clients/${clientId}`);
|
||||||
|
}
|
||||||
|
|
||||||
getClientDataAndTemplate(clientId: string) {
|
getClientDataAndTemplate(clientId: string) {
|
||||||
const httpParams = new HttpParams()
|
const httpParams = new HttpParams()
|
||||||
.set('template', 'true')
|
.set('template', 'true')
|
||||||
@@ -86,18 +90,11 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/${clientId}/charges`, { params: httpParams });
|
return this.http.get(`/clients/${clientId}/charges`, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param chargeData Charge Data to be waived.
|
|
||||||
*/
|
|
||||||
waiveClientCharge(chargeData: any) {
|
waiveClientCharge(chargeData: any) {
|
||||||
const httpParams = new HttpParams().set('command', 'waive');
|
const httpParams = new HttpParams().set('command', 'waive');
|
||||||
return this.http.post(`/clients/${chargeData.clientId}/charges/${chargeData.resourceType}`, chargeData, { params: httpParams });
|
return this.http.post(`/clients/${chargeData.clientId}/charges/${chargeData.resourceType}`, chargeData, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get All Client Cgarges.
|
|
||||||
* @param clientId Client Id of the user.
|
|
||||||
*/
|
|
||||||
getAllClientCharges(clientId: string) {
|
getAllClientCharges(clientId: string) {
|
||||||
return this.http.get(`/clients/${clientId}/charges`);
|
return this.http.get(`/clients/${clientId}/charges`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user