Guest User

schedule.ts

a guest
Jan 30th, 2018
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. import { Component} from '@angular/core';
  2.  
  3. import {NavController} from 'ionic-angular';
  4. import { Storage } from "@ionic/storage";
  5.  
  6. //import { ConferenceData } from '../../providers/conference-data';
  7. import { UserData } from '../../providers/user-data';
  8. import { OsDataProvider} from '../../providers/os-data/os-data';
  9.  
  10. import {OsDetalhesPage} from "../os-detalhes/os-detalhes";
  11. //import {OsDetalhesPage} from "../os-detalhes/os-detalhes";
  12.  
  13.  
  14.  
  15.  
  16. @Component({
  17. selector: 'page-schedule',
  18. templateUrl: 'schedule.html'
  19. })
  20. export class SchedulePage {
  21. username: string;
  22. nome_cliente: string;
  23. public lista_os = new Array<any>();
  24. //result: any;
  25. //users: any[];
  26. //fullName = [];
  27. //options: any;
  28. //local: any;
  29. //public location: any;
  30. // public fullDetails: any[];
  31. public osDetails: any;
  32. public userDetails: any;
  33. data: any;
  34. //userPostData = {"email":"","name":"","user_id":""};
  35. // login: UserOptions = { username: '', password: '' };
  36. //userID = { codtecnico: '' };
  37. // responseData: any;
  38. //submitted = false;
  39. // @ViewChild(InfiniteScroll) infiniteScroll: InfiniteScroll;
  40.  
  41. rootPage: any = SchedulePage;
  42.  
  43. constructor(
  44. //public alertCtrl: AlertController,
  45. public nav: NavController,
  46. public userData: UserData,
  47. public OSData: OsDataProvider,
  48. public navCtrl: NavController,
  49. //public loginData: UserData,
  50. // public authService: AuthService,
  51. public storage: Storage,
  52. // public platform: Platform,
  53. // public geolocation: Geolocation
  54. //private geoposition: Geoposition,
  55. //private diagnostic: Diagnostic,
  56. //public toastCtrl: ToastController
  57. ) {
  58. this.storage.get('userData').then((data:any) => {
  59. const dados = JSON.parse(data);
  60. //this.lista_os = dados;
  61. //console.log(this.lista_os);
  62. if (dados) {
  63. this.userDetails = dados.userid[0].userData;
  64. this.lista_os = dados.userid[1].OSData;
  65. console.log(this.lista_os = dados.userid[1].OSData);
  66. //console.log(this.osDetails = dados.userid[1].OSData[0]);
  67. //this.userID.codtecnico = dados.userData.user_id;
  68. }
  69. });
  70.  
  71.  
  72.  
  73. }
  74.  
  75. ionViewDidEnter() {
  76. this.getUsername();
  77. this.getNomeCliente();
  78. }
  79.  
  80.  
  81. getUsername() {
  82. this.userData.getUsername().then((name) => {
  83. this.username = name;
  84. //console.log('Name',name);
  85. });
  86. };
  87.  
  88. getNomeCliente(){
  89. this.OSData.getNomeCliente().then((name) => {
  90. this.nome_cliente = name;
  91. });
  92.  
  93. };
  94.  
  95.  
  96. abrirDetalhes(){
  97. this.navCtrl.push(OsDetalhesPage);
  98. };
  99.  
  100.  
  101. }
Add Comment
Please, Sign In to add comment