summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/portalsdk-tag-lib-test-app/src/app/shared/services/app.service.ts
blob: 0860e113efdae0fb6c120d3ed4f5db2d61987da4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Injectable } from '@angular/core';
import { RdpCrudInterface } from 'portalsdk-tag-lib';
import { HttpClient, HttpParams } from '@angular/common/http';
import { map } from "rxjs/operators";
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class AppService implements RdpCrudInterface{
    
  constructor(private http:HttpClient) {  }
  add(data:any){ 
      console.log("Add method is getting called from AppServie data:: ",data);
  }

  update(data:any){ 
    console.log("Update method is getting called from AppServie data:: ",data);
  }

  delete(data:any){ 
    console.log("Delete method is getting called from AppServie data::>> ",data);
  }

  get(data: any) {
    console.log("get method is getting called from AppServie data:: ",data);
  }

  loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any):  Observable<any[]>{
    let users = [];
    if(pageIndex == 0){
      users = [
        {"id": "1", "name": "Sundar","company": "AT&T","location": "USA"},
        {"id": "2", "name": "Kishore", "company": "AT&T","location": "USA"},
        {"id": "3", "name": "Sudarshan","company": "AT&T","location": "India"},
        {"id": "4", "name": "Jegadeesh","company": "AT&T","location": "India"},
        {"id": "5", "name": "Muni","company": "AT&T","location": "USA"}
      ];
    }
    if(pageIndex == 1){
      users = [
        {"id": "6", "name": "Abhay","company": "AT&T","location": "USA"},
        {"id": "7", "name": "Tom", "company": "AT&T","location": "USA"},
        {"id": "8", "name": "Rachitha","company": "AT&T","location": "India"},
        {"id": "9", "name": "Shankar","company": "AT&T","location": "India"},
        {"id": "10", "name": "Balaji","company": "AT&T","location": "USA"}
      ];
    }
    console.log("applicationService loadTableData called ::");
    console.log("applicationService loadTableData filter ::",filter);
    console.log("applicationService loadTableData sort-Active ::",sortActive);
    console.log("applicationService loadTableData sortDirection ::",sortDirection);
    console.log("applicationService loadTableData pageIndex ::",pageIndex);
    console.log("applicationService loadTableData pageSize ::",pageSize);
    return Observable.create( observer => {
      observer.next(users);
      observer.complete();
    });
  }

  getTotalRowCount(): any {
    //write logic to get total row Counts of Table
    return 10;
  }

}