import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { AppUtil } from '../../providers/app-util/app-util'; import { SyncManagerSvc } from '../../providers/sync-manager/sync-manager'; /** * Generated class for the SyncManagerPage page. * * See https://ionicframework.com/docs/components/#navigation for more info on * Ionic pages and navigation. */ @IonicPage() @Component({ selector: 'page-sync-manager', templateUrl: 'sync-manager.html', }) export class SyncManagerPage { data = { }; constructor(public navCtrl: NavController, public navParams: NavParams, public syncManager: SyncManagerSvc, public appUtil: AppUtil) { this.Intialization(); } Intialization() { var me=this; this.syncManager.getUnsyncedTable().then(function (Ldata) { for (var i in Ldata) { Ldata[i].tableName = me.syncManager.list[i]; } me.data['tableList'] = Ldata; }); } syncAllRecords(tableList) { var me = this; me.appUtil.confirm('Do you want to Sync All Table Records', '').then(function (ok) { for (var i in tableList) { if (!tableList[i].syncstatus) { me.syncManager.syncDataWithServer(tableList[i].tableName, tableList[i]).then(function (ok) { me.Intialization(); }, function (err) { console.error(err); me.Intialization(); }); } } }, (cancel)=>{ alert("Cancel clicked!"); }); } syncTable(tablename, tableData) { var me = this; me.appUtil.confirm('Do you Want to Sync: ' + tablename, 'Sync').then(function (ok) { me.syncManager.syncDataWithServer(tablename, tableData).then(function (ok) { me.Intialization(); }, function (err) { console.error(err); me.Intialization(); }); }); }; showAlert() { alert("dmoooodsgsd"); } }