Commit 08d29c0d authored by mohan122's avatar mohan122

Done_youritemsPage

parent 3f7a76a7
......@@ -8,7 +8,6 @@
<ion-navbar color="vamsi">
<ion-title>HOME</ion-title>
<span style="color:rgb(255, 255, 255)">{{this.record}}</span>
<ion-buttons end id="BUTON">
<button (click)="Logout()" id="BUTON">
<ion-icon name="log-out" color="white"></ion-icon>
......@@ -16,7 +15,9 @@
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content>
......
......@@ -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) {
this.record=navParams.get('emails')
console.log(this.record);
/*this.listItems=[{
}];*/
......@@ -64,6 +63,7 @@ record:any;
Weightf:[''],
piecesf:[''],
costf:[''],
emailf:['this.record'],
});
......@@ -73,10 +73,10 @@ record:any;
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' }),
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 ;
this.http.post(url, JSON.stringify(options), headers)
......@@ -112,10 +112,11 @@ record:any;
coste:number=this.registeritems.controls["coste"].value,
weightf : number = this.registeritems.controls["Weightf"].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{
this.listItems.push({
......
......@@ -27,9 +27,10 @@ export class LoginPage {
login(user:User){
this.fire.auth.signInWithEmailAndPassword(this.user.email,this.user.password)
.then(data =>{
this.navCtrl.setRoot(TabhPage);
this.navCtrl.setRoot(TabhPage,{emails: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=>{
......
......@@ -5,6 +5,8 @@ import { Component ,ViewChild } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation';
import { FormBuilder,FormGroup} from '@angular/forms';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';
......@@ -27,8 +29,9 @@ export class RegisterPage {
location:any;
public register:FormGroup;
private baseURI : string = "http://localhost/vamsi/register.php";
constructor(private fire: AngularFireAuth, public http: HttpClient,public formBuilder:FormBuilder,public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) {
latitude:any;
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({
name:[''],
mobile:[''],
......@@ -82,11 +85,25 @@ export class RegisterPage {
.catch(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(()=>{
let options={timeout:3000,enableHighAccuracy:true,maximumAge:0}
this.geolocation.getCurrentPosition(options).then((location) => {
console.log('Fetched the location successfully',location);
this.location=location;
this.latitude=location.coords.latitude;
this.longitude=location.coords.latitude;
}).catch((error) => {
console.log('Error getting location', error);
});
......
......@@ -2,6 +2,7 @@
<ion-navbar color="vamsi">
<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">
<button (click)="Logout()" id="BUTON">
<ion-icon name="log-out" color="white"></ion-icon>
......
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';
/**
......@@ -19,11 +19,13 @@ export class TabhPage {
homeRoot = 'HomePage'
yourItemsRoot = 'YourItemsPage'
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(){
let alert = this.alertCtrl.create({
title: 'CONFIRM LOGOUT',
......
......@@ -20,5 +20,65 @@
</ion-header>
<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>
\ No newline at end of file
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { LoginPage } from '../login/login';
import { HttpClient } from '@angular/common/http';
/**
* Generated class for the YourItemsPage page.
......@@ -15,12 +16,32 @@ import { LoginPage } from '../login/login';
templateUrl: 'your-items.html',
})
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(){
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() {
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