import { RdpCrudInterface } from 'portalsdk-tag-lib';
import { environment } from 'src/environments/environment';
import { AdminService } from '../admin.service';
+import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class MenusService implements RdpCrudInterface {
+ public statusResponse = new BehaviorSubject("");
+ public updatedData = new BehaviorSubject<any>({});
+
+ loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): import("rxjs").Observable<any[]> {
+ throw new Error("Method not implemented.");
+ }
+ getTotalRowCount() {
+ throw new Error("Method not implemented.");
+ }
+
parentDataList: any;
constructor(private http: HttpClient, private adminService: AdminService) {
this.adminService.updateFnMenuItem(postData)
.subscribe(_data => {
console.log("Response : ", _data);
+ this.statusResponse.next("200");
}, error => {
console.log("Error : ", error);
});
let result = { availableFnMenuItem: data };
this.adminService.deleteMenu(result).subscribe(response => {
console.log("Response ", response);
+ this.statusResponse.next("200");
+ }, error =>{
+ console.log("Error : ", error);
})
}
}
}
- get(data: any) {
- console.log("get method is getting called from AppServie data:: ", data);
+ get() {
+ console.log("get method is getting called from AppServie data:: ");
+ let response = this.adminService.getFnMenuItems();
+ let resp;
+ response.subscribe(res => {
+ console.log("Get Response : ", res);
+ resp = res;
+ console.log("edited : ",JSON.parse(resp.data).fnMenuItems);
+ this.updatedData.next(JSON.parse(resp.data).fnMenuItems);
+ })
}
}
import { Injectable } from '@angular/core';
import { RdpCrudInterface } from 'portalsdk-tag-lib';
import { AdminService } from '../admin.service';
+import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class RoleFunctionsService implements RdpCrudInterface {
+ public statusResponse = new BehaviorSubject("");
+ public updatedData = new BehaviorSubject<any>({});
+
+ loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): import("rxjs").Observable<any[]> {
+ throw new Error("Method not implemented.");
+ }
+ getTotalRowCount() {
+ throw new Error("Method not implemented.");
+ }
+
constructor(private adminService: AdminService) { }
add(data: any) {
- console.log("Add method is getting called from AppServie data:: ", data);
+ console.log("Add method is getting called from RoleFunctionService data:: ", data);
}
- update(data: any) {
- console.log("Update method is getting called from MenusService data:: ", data);
- this.adminService.saveRoleFunction(data).subscribe(response => {
- console.log(response);
+ update(data: any): any {
+ console.log("Update method is getting called from RoleFunctionService data:: ", data);
+ return this.adminService.saveRoleFunction(data).subscribe(response => {
+ console.log("Success Response ", response);
+ this.statusResponse.next("200");
+ }, error => {
+ console.log("Error ", error);
})
}
delete(data: any) {
- console.log("Delete method is getting called from AppServie data::>> " + JSON.stringify(data));
+ console.log("Delete method is getting called from RoleFunctionService data::>> " + JSON.stringify(data));
this.adminService.deleteRoleFunction(data).subscribe(response => {
- console.log("Repsonse : ",response);
+ console.log("Repsonse : ", response);
+ this.statusResponse.next("200");
+
})
}
- get(data: any) {
- console.log("get method is getting called from AppServie data:: ", data);
+ get() {
+ let response = this.adminService.getRoleFunctionList();
+ let editedData;
+ response.subscribe(res => {
+ editedData = res;
+ let data = JSON.parse(JSON.parse(editedData.data).availableRoleFunctions);
+ console.log("Get Method called : ", data);
+ this.updatedData.next(data);
+ })
}
}
</div>
</div>
<div class="form-row">
- <label for="textinputID-3a">Organization User ID</label>
+ <label for="textinputID-3a">Organization User ID</label> <a style="cursor: hand;" target="_new"
+ href="http://webphone.att.com/cgi-bin/webphones.pl?id={{profile.orgUserId}}">wephone</a>
<input [(ngModel)]="profile.orgUserId" type="text" name="orgUserId" class="form-control" id="orgUserId"
style="width: 100%;" disabled="true">
</div>
<div class="form-row">
<label for="textinputID-3a">Organization Manager ID</label>
-
+ <a style="cursor: hand;" target="_new"
+ href="http://webphone.att.com/cgi-bin/webphones.pl?id={{profile.orgManagerUserId}}">wephone</a>
<input [(ngModel)]="profile.orgManagerUserId" type="text" name="orgManagerUserId" class="form-control"
id="orgManagerUserId" style="
</div>
- <table mat-table [dataSource]="dataSource" matSort>
- <ng-container matColumnDef="name">
- <th mat-header-cell *matHeaderCellDef id="heading1"> Name</th>
- <td mat-cell *matCellDef="let rowData"> {{rowData.name}} </td>
- </ng-container>
-
- <!--<ng-container matColumnDef="delete">
- <th mat-header-cell *matHeaderCellDef id="heading2"> Delete</th>
- <td id="rowheader_t1_{{i}}" mat-cell *matCellDef="let rowData; let i=index;">
- <span class="icon-trash" id="{{i}}-button-role-remove" (click)="removeRole(rowData)">
- <i class="icon ion-md-trash"></i>
- </span>
- </td>
- </ng-container>-->
-
- <!-- Active Column -->
- <ng-container matColumnDef="active">
- <th id="col3" mat-header-cell *matHeaderCellDef>Active ?</th>
- <td id="rowheader_t1_{{i}}-userId" mat-cell *matCellDef="let element; let i=index;">
- <mat-slide-toggle [(ngModel)]="element.selected" (change)="toggleRoles(element)"></mat-slide-toggle>
- </td>
- </ng-container>
-
- <tr mat-header-row *matHeaderRowDef="userRolesHeader"></tr>
- <tr mat-row *matRowDef="let rowData; columns: userRolesHeader;">
-
- </table>
+ <rdp-data-table [data]="ociavailableRoles" [settings]="settings"></rdp-data-table>
<span class="ecomp-spinner" *ngIf="showSpinner"></span>
</div>
</div>
\ No newline at end of file
import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component';
import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
+import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib';
@Component({
selector: 'app-self',
selectedTimeZone;
finalSelectedRoles: any;
+ public settings;
+ public columns: any = [];
+
ngOnInit() {
this.showSpinner = false;
}
}
- this.dataSource = new MatTableDataSource(this.ociavailableRoles);
+ console.log("Data : ", this.ociavailableRoles);
+ this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null));
+ this.settings = new DataTableSettings()
+ this.settings.columns = this.columns;
+ this.settings.isPaginationEnabled = false;
+ this.settings.isReadOnly = true;
+ this.settings.isTableSearchEnabled = false;
+ this.settings.isToggleEnabled = true;
if (this.ociavailableRoles != null) {
for (let role of this.ociavailableRoles) {
@Input() settings: any;
@Input() rowdata: any;
@Input() isEditMode: boolean;
+ @Input() applicationService: any;
@Output() passEntry: EventEmitter<any> = new EventEmitter();
modalPopupTitle: string;
selectedRowData: any;
}
saveChanges() {
- this.passEntry.emit(this.rowdata);
+ this.applicationService.update(this.rowdata);
+ this.applicationService.statusResponse.subscribe(responseData => {
+ if (responseData == "200") {
+ console.log("Success")
+ this.applicationService.get();
+ this.applicationService.updatedData.subscribe(val => {
+ if (val) {
+ this.passEntry.emit(val);
+ }
+ })
+ }
+ })
this.activeModal.close();
}
<i class="icon ion-md-person-add"></i> Add
</button>
</div>
+ <span class="rdp-spinner" *ngIf="showSpinner"></span>
<!-- <rdp-scroll-container [more]="hasMore()" [scrollOffset]="2500" [scrollDelay]="3000" (scrolled)="handleScroll($event)"
[class.full]="full" [class.part]="!full"> -->
<table mat-table #table [dataSource]="dataSource" style="width: 100%" matSort>
showAddButton: boolean = true;
result : any;
totalRowsCount: any;
-
+ showSpinner: boolean;
constructor(public dataTableService: RdpDataTableService, private rdpModal: RdpModalService) { }
* @param rowData
*/
openEditModalPopup(rowData: any) {
+ this.showSpinner = true;
+ console.log("Row data : ", rowData);
this.cloneObject = Object.assign({}, rowData)
- console.log("Copied Object : ", this.cloneObject);
- if (this.cloneObject) {
- const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' });
- modalRef.componentInstance.title = 'Edit';
- modalRef.componentInstance.settings = this.settings;
- if (this.cloneObject != 'undefined' && this.cloneObject) {
- modalRef.componentInstance.rowdata = this.cloneObject;
- modalRef.componentInstance.isEditMode = true;
- this.isEditMode = true;
- } else {
- modalRef.componentInstance.rowdata = {};
- modalRef.componentInstance.isEditMode = false;
- this.isEditMode = false;
- }
- modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
- if (receivedEntry) {
- console.log("Original Object : ", rowData);
- let response = this.updateRow(receivedEntry);
- console.log("Response form application ",response);
- console.log("Entry : ",receivedEntry);
- rowData = receivedEntry;
- if(this.dataTableService.response == "Success"){
- console.log("Result is success, update the tabel");
- this.columnsInfoList.push(receivedEntry);
- console.log("Updtae column info list : ", this.columnsInfoList);
- }
- }
- });
+ console.log("Update or Add functionality intialized");
+ const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' });
+ modalRef.componentInstance.title = 'Edit';
+ modalRef.componentInstance.settings = this.settings;
+ if (this.cloneObject.data != 'undefined' && this.cloneObject) {
+ modalRef.componentInstance.rowdata = this.cloneObject;
+ modalRef.componentInstance.applicationService = this.applicationService;
+ modalRef.componentInstance.isEditMode = true;
+ this.isEditMode = true;
+ } else {
+ modalRef.componentInstance.rowdata = {};
+ modalRef.componentInstance.isEditMode = false;
+ this.isEditMode = false;
}
+ modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => {
+ if (receivedEntry) {
+ this.data = receivedEntry;
+ this.setData(this.data);
+ }
+ this.showSpinner = false;
+ });
+
}
handleScroll = (scrolled: boolean) => {
export * from './lib/rdp/model/column';
export * from './lib/rdp/model/data-table-settings';
export * from './lib/rdp/rdp.module';
-export * from './lib/rdp/shared/rdpCrudInterface';
\ No newline at end of file
+export * from './lib/rdp/shared/rdpCrudInterface';
+export * from './lib/rdp/services/rdp-modal.service';
\ No newline at end of file