Commit 08d29c0d authored by mohan122's avatar mohan122

Done_youritemsPage

parent 3f7a76a7
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<ion-navbar color="vamsi"> <ion-navbar color="vamsi">
<ion-title>HOME</ion-title> <ion-title>HOME</ion-title>
<span style="color:rgb(255, 255, 255)">{{this.record}}</span>
<ion-buttons end id="BUTON"> <ion-buttons end id="BUTON">
<button (click)="Logout()" id="BUTON"> <button (click)="Logout()" id="BUTON">
<ion-icon name="log-out" color="white"></ion-icon> <ion-icon name="log-out" color="white"></ion-icon>
...@@ -16,7 +15,9 @@ ...@@ -16,7 +15,9 @@
</ion-buttons> </ion-buttons>
</ion-navbar> </ion-navbar>
</ion-header> </ion-header>
<ion-content> <ion-content>
......
...@@ -37,7 +37,6 @@ record:any; ...@@ -37,7 +37,6 @@ record:any;
constructor(public navCtrl: NavController,private formBuilder:FormBuilder, public http: HttpClient,public navParams: NavParams,private fire:AngularFireAuth,private toast:ToastController) { constructor(public navCtrl: NavController,private formBuilder:FormBuilder, public http: HttpClient,public navParams: NavParams,private fire:AngularFireAuth,private toast:ToastController) {
this.record=navParams.get('emails') this.record=navParams.get('emails')
console.log(this.record);
/*this.listItems=[{ /*this.listItems=[{
}];*/ }];*/
...@@ -64,6 +63,7 @@ record:any; ...@@ -64,6 +63,7 @@ record:any;
Weightf:[''], Weightf:[''],
piecesf:[''], piecesf:[''],
costf:[''], costf:[''],
emailf:['this.record'],
}); });
...@@ -73,10 +73,10 @@ record:any; ...@@ -73,10 +73,10 @@ record:any;
this.registeritems.reset(); this.registeritems.reset();
} }
createEntry(EMAIL : string,weighta:number,piecesa:number,costa:number,weightb:number,piecesb:number,costb:number,weightc:number,piecesc:number,costc:number,weightd:number,piecesd:number,costd:number,weighte:number,piecese:number,coste:number,weightf:number,piecesf:number,costf:number) : void createEntry(EMAIL : string,weighta:number,piecesa:number,costa:number,weightb:number,piecesb:number,costb:number,weightc:number,piecesc:number,costc:number,weightd:number,piecesd:number,costd:number,weighte:number,piecese:number,coste:number,weightf:number,piecesf:number,costf:number,emailf:string) : void
{ {
let headers : any = new HttpHeaders({ 'Content-Type': 'application/json' }), let headers : any = new HttpHeaders({ 'Content-Type': 'application/json' }),
options : any = { "key" : "create", "EMAIL" : EMAIL, "weighta" : weighta,"piecesa":piecesa,"costa":costa, "weightb" : weightb,"piecesb":piecesb,"costb":costb, "weightc" : weightc,"piecesc":piecesc,"costc":costc, "weightd" : weightd,"piecesd":piecesd,"costd":costd, "weighte" : weighte,"piecese":piecese,"coste":coste, "weightf" : weightf,"piecesf":piecesf,"costf":costf }, options : any = { "key" : "create", "EMAIL" : EMAIL, "weighta" : weighta,"piecesa":piecesa,"costa":costa, "weightb" : weightb,"piecesb":piecesb,"costb":costb, "weightc" : weightc,"piecesc":piecesc,"costc":costc, "weightd" : weightd,"piecesd":piecesd,"costd":costd, "weighte" : weighte,"piecese":piecese,"coste":coste, "weightf" : weightf,"piecesf":piecesf,"costf":costf,"emailf":emailf },
url : any = this.baseURI ; url : any = this.baseURI ;
this.http.post(url, JSON.stringify(options), headers) this.http.post(url, JSON.stringify(options), headers)
...@@ -112,10 +112,11 @@ record:any; ...@@ -112,10 +112,11 @@ record:any;
coste:number=this.registeritems.controls["coste"].value, coste:number=this.registeritems.controls["coste"].value,
weightf : number = this.registeritems.controls["Weightf"].value, weightf : number = this.registeritems.controls["Weightf"].value,
piecesf : number = this.registeritems.controls["piecesf"].value, piecesf : number = this.registeritems.controls["piecesf"].value,
costf:number=this.registeritems.controls["costf"].value costf:number=this.registeritems.controls["costf"].value,
emailf:string=this.registeritems.controls["emailf"].value
this.createEntry(EMAIL,weighta,piecesa,costa,weightb,piecesb,costb,weightc,piecesc,costc,weightd,piecesd,costd,weighte,piecese,coste,weightf,piecesf,costf); this.createEntry(EMAIL,weighta,piecesa,costa,weightb,piecesb,costb,weightc,piecesc,costc,weightd,piecesd,costd,weighte,piecese,coste,weightf,piecesf,costf,emailf);
} }
/*public additem():void{ /*public additem():void{
this.listItems.push({ this.listItems.push({
......
...@@ -27,9 +27,10 @@ export class LoginPage { ...@@ -27,9 +27,10 @@ export class LoginPage {
login(user:User){ login(user:User){
this.fire.auth.signInWithEmailAndPassword(this.user.email,this.user.password) this.fire.auth.signInWithEmailAndPassword(this.user.email,this.user.password)
.then(data =>{ .then(data =>{
this.navCtrl.setRoot(TabhPage); this.navCtrl.setRoot(TabhPage,{emails:this.user.email});
console.log(this.user.email); console.log(this.user.email);
this.navCtrl.push(HomePage,{emails:this.user.email}); //this.navCtrl.push(HomePage,{emails:this.user.email});
//this.navCtrl.push(TabhPage,{emails:this.user.email});
}) })
.catch(error=>{ .catch(error=>{
......
...@@ -5,6 +5,8 @@ import { Component ,ViewChild } from '@angular/core'; ...@@ -5,6 +5,8 @@ import { Component ,ViewChild } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation'; import { Geolocation } from '@ionic-native/geolocation';
import { FormBuilder,FormGroup} from '@angular/forms'; import { FormBuilder,FormGroup} from '@angular/forms';
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';
...@@ -27,8 +29,9 @@ export class RegisterPage { ...@@ -27,8 +29,9 @@ export class RegisterPage {
location:any; location:any;
public register:FormGroup; public register:FormGroup;
private baseURI : string = "http://localhost/vamsi/register.php"; private baseURI : string = "http://localhost/vamsi/register.php";
latitude:any;
constructor(private fire: AngularFireAuth, public http: HttpClient,public formBuilder:FormBuilder,public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) { longitude:any;
constructor(private fire: AngularFireAuth,private nativeGeocoder: NativeGeocoder, public http: HttpClient,public formBuilder:FormBuilder,public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) {
this.register=this.formBuilder.group({ this.register=this.formBuilder.group({
name:[''], name:[''],
mobile:[''], mobile:[''],
...@@ -82,11 +85,25 @@ export class RegisterPage { ...@@ -82,11 +85,25 @@ export class RegisterPage {
.catch(error=>{ .catch(error=>{
console.log('got error',error); console.log('got error',error);
}); });
this.platform.ready().then(()=>{
this.nativeGeocoder.reverseGeocode(this.latitude,this.longitude)
.then((result: NativeGeocoderReverseResult) => {
console.log(JSON.stringify(result));
})
.catch((error: any) =>{
console.log(error);
});
});
this.platform.ready().then(()=>{ this.platform.ready().then(()=>{
let options={timeout:3000,enableHighAccuracy:true,maximumAge:0} let options={timeout:3000,enableHighAccuracy:true,maximumAge:0}
this.geolocation.getCurrentPosition(options).then((location) => { this.geolocation.getCurrentPosition(options).then((location) => {
console.log('Fetched the location successfully',location); console.log('Fetched the location successfully',location);
this.location=location; this.location=location;
this.latitude=location.coords.latitude;
this.longitude=location.coords.latitude;
}).catch((error) => { }).catch((error) => {
console.log('Error getting location', error); console.log('Error getting location', error);
}); });
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<ion-navbar color="vamsi"> <ion-navbar color="vamsi">
<ion-title>HEADER</ion-title> <ion-title>HEADER</ion-title>
<span style="color:rgb(255, 255, 255);padding-left:11px;font-weight:bold;font-size:10px;">UID:{{this.record}}</span>
<ion-buttons end id="BUTON"> <ion-buttons end id="BUTON">
<button (click)="Logout()" id="BUTON"> <button (click)="Logout()" id="BUTON">
<ion-icon name="log-out" color="white"></ion-icon> <ion-icon name="log-out" color="white"></ion-icon>
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, AlertController } from 'ionic-angular'; import { IonicPage, NavController,NavParams, AlertController } from 'ionic-angular';
import { LoginPage } from '../login/login'; import { LoginPage } from '../login/login';
/** /**
...@@ -19,11 +19,13 @@ export class TabhPage { ...@@ -19,11 +19,13 @@ export class TabhPage {
homeRoot = 'HomePage' homeRoot = 'HomePage'
yourItemsRoot = 'YourItemsPage' yourItemsRoot = 'YourItemsPage'
editHistoryRoot = 'EditHistoryPage' editHistoryRoot = 'EditHistoryPage'
record:any;
constructor(public navCtrl: NavController,private alertCtrl: AlertController) {} constructor(public navCtrl: NavController,private alertCtrl: AlertController,public navParams: NavParams) {
this.record=navParams.get('emails')
}
Logout(){ Logout(){
let alert = this.alertCtrl.create({ let alert = this.alertCtrl.create({
title: 'CONFIRM LOGOUT', title: 'CONFIRM LOGOUT',
......
...@@ -20,5 +20,65 @@ ...@@ -20,5 +20,65 @@
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<ion-item *ngFor="let item of items">
<ion-card>
<ion-card-header style="background-color:#FFA500;font-weight:bold;color:white;">
<ion-icon name="cart">
{{item.EMAIL}}
</ion-icon>
</ion-card-header>
<div style="padding:0px">
<div class="row" style="padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;font-weight:bold;">
<div class="col">WEIGHT</div>
<div class="col">PIECES</div>
<div class="col">COST</div>
</div>
<div class="row" style="background-color:#f2f2f2;">
<div class="col">{{item.weighta}}</div>
<div class="col">{{item.piecesa}}</div>
<div class="col">{{item.costa}}</div>
</div>
<div class="row">
<div class="col">{{item.weightb}}</div>
<div class="col">{{item.piecesb}}</div>
<div class="col">{{item.costb}}</div>
</div>
<div class="row" style="background-color:#f2f2f2;">
<div class="col">{{item.weightc}}</div>
<div class="col">{{item.piecesc}}</div>
<div class="col">{{item.costc}}</div>
</div>
<div class="row">
<div class="col">{{item.weightd}}</div>
<div class="col">{{item.piecesd}}</div>
<div class="col">{{item.costd}}</div>
</div>
<div class="row" style="background-color:#f2f2f2;">
<div class="col">{{item.weighte}}</div>
<div class="col">{{item.piecese}}</div>
<div class="col">{{item.coste}}</div>
</div>
<div class="row">
<div class="col">{{item.weightf}}</div>
<div class="col">{{item.piecesf}}</div>
<div class="col">{{item.costf}}</div>
</div>
</div>
</ion-card>
</ion-item>
</ion-content> </ion-content>
\ No newline at end of file
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { LoginPage } from '../login/login'; import { LoginPage } from '../login/login';
import { HttpClient } from '@angular/common/http';
/** /**
* Generated class for the YourItemsPage page. * Generated class for the YourItemsPage page.
...@@ -15,12 +16,32 @@ import { LoginPage } from '../login/login'; ...@@ -15,12 +16,32 @@ import { LoginPage } from '../login/login';
templateUrl: 'your-items.html', templateUrl: 'your-items.html',
}) })
export class YourItemsPage { export class YourItemsPage {
public items : Array<any> = [];
constructor(public navCtrl: NavController, public navParams: NavParams) { constructor(public navCtrl: NavController, public navParams: NavParams,public http : HttpClient) {
} }
Logout(){ Logout(){
this.navCtrl.setRoot(LoginPage); this.navCtrl.setRoot(LoginPage);
} }
ionViewWillEnter() : void
{
this.load();
}
load() : void
{
this.http
.get('http://localhost/vamsi/itemretrive.php')
.subscribe((data : any) =>
{
console.dir(data);
this.items = data;
},
(error : any) =>
{
console.dir(error);
});
}
ionViewDidLoad() { ionViewDidLoad() {
console.log('ionViewDidLoad YourItemsPage'); console.log('ionViewDidLoad YourItemsPage');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment