Commit 3f7a76a7 authored by mohan122's avatar mohan122

mailidonheader

parent 5b9306e3
This diff is collapsed.
......@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams, ToastController } from 'ionic-angu
import {AngularFireAuth} from 'angularfire2/auth';
import { LoginPage } from '../login/login';
import { FormBuilder,FormGroup} from '@angular/forms';
import { HttpClient, HttpHeaders } from '@angular/common/http';
......@@ -24,9 +25,9 @@ export class HomePage {
registeritems:FormGroup;
public isKgsSelected: boolean;
public isPiecesSelected: boolean;
private baseURI : string = "http://localhost/vamsi/updateitems.php";
record:any;
/* public listItems: any;*/
......@@ -34,33 +35,35 @@ public isPiecesSelected: boolean;
constructor(public navCtrl: NavController,private formBuilder:FormBuilder, 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')
console.log(this.record);
/*this.listItems=[{
}];*/
this.registeritems=this.formBuilder.group({
nameofitem:[''],
aq:[''],
price:[''],
Weight1:[''],
pieces1:[''],
cost1:[''],
Weight2:[''],
pieces2:[''],
cost2:[''],
Weight3:[''],
pieces3:[''],
cost3:[''],
Weight4:[''],
pieces4:[''],
cost4:[''],
Weight5:[''],
pieces5:[''],
cost5:[''],
Weight6:[''],
pieces6:[''],
cost6:[''],
Weighta:[''],
piecesa:[''],
costa:[''],
Weightb:[''],
piecesb:[''],
costb:[''],
Weightc:[''],
piecesc:[''],
costc:[''],
Weightd:[''],
piecesd:[''],
costd:[''],
Weighte:[''],
piecese:[''],
coste:[''],
Weightf:[''],
piecesf:[''],
costf:[''],
});
......@@ -69,6 +72,51 @@ public isPiecesSelected: boolean;
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
{
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 },
url : any = this.baseURI ;
this.http.post(url, JSON.stringify(options), headers)
.subscribe((data : any) =>
{
// If the request was successful notify the user
console.log(`Congratulations the ${EMAIL} was successfully added`);
this.registeritems.reset();
},
(error : any) =>
{
console.log('Something went wrong!');
});
}
saveEntry() : void
{
let EMAIL : string = this.registeritems.controls["nameofitem"].value,
weighta : number = this.registeritems.controls["Weighta"].value,
piecesa : number = this.registeritems.controls["piecesa"].value,
costa:number=this.registeritems.controls["costa"].value,
weightb : number = this.registeritems.controls["Weightb"].value,
piecesb : number = this.registeritems.controls["piecesb"].value,
costb:number=this.registeritems.controls["costb"].value,
weightc : number = this.registeritems.controls["Weightc"].value,
piecesc : number = this.registeritems.controls["piecesc"].value,
costc:number=this.registeritems.controls["costc"].value,
weightd : number = this.registeritems.controls["Weightd"].value,
piecesd : number = this.registeritems.controls["piecesd"].value,
costd:number=this.registeritems.controls["costd"].value,
weighte : number = this.registeritems.controls["Weighte"].value,
piecese : number = this.registeritems.controls["piecese"].value,
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
this.createEntry(EMAIL,weighta,piecesa,costa,weightb,piecesb,costb,weightc,piecesc,costc,weightd,piecesd,costd,weighte,piecese,coste,weightf,piecesf,costf);
}
/*public additem():void{
this.listItems.push({
name: "vamsi",
......@@ -76,6 +124,7 @@ public isPiecesSelected: boolean;
});
}*/
selectItem(Mode)
{
if(Mode == 'Kgs')
......
......@@ -6,4 +6,4 @@ page-login {
background: color($colors, white);
width: 95%;
}
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import { TabhPage } from '../tabh/tabh';
})
export class LoginPage {
user={} as User;
public email:any;
constructor(public navCtrl: NavController, public navParams: NavParams,private fire:AngularFireAuth,private alertctrl:AlertController) {
}
......@@ -27,7 +28,8 @@ export class LoginPage {
this.fire.auth.signInWithEmailAndPassword(this.user.email,this.user.password)
.then(data =>{
this.navCtrl.setRoot(TabhPage);
console.log(this.user.email);
this.navCtrl.push(HomePage,{emails:this.user.email});
})
.catch(error=>{
......
......@@ -4,10 +4,15 @@
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>maps</ion-title>
<ion-header color="vamsi">
<ion-navbar color="vamsi">
<ion-title>TRACING..</ion-title>
<ion-buttons end id="BUTON">
<button ion-button large (click)="mapUser()" id="BUTON">
<ion-icon large name="locate" color="white"></ion-icon>
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
......@@ -19,15 +24,15 @@
<ion-label floating>LOCATION</ion-label>
<ion-input type="text" value="{{ location?.coords.latitude}} {{ location?.coords.longitude }}" readonly></ion-input>
</ion-item>
-->
<div padding>
<button block ion-button color="vamsi" style="padding:0px; width: 100%;" medium (click)="mapUser()">LOCATE ME</button>
<button outline ion-button id="vamsi" color="light" style=" z-index:2; padding:0px; width: 100%;" [disabled]="disabled" small (click)="mapUser()">LOCATE ME</button>
</div>
-->
<agm-map [disableDefaultUI]="true" [latitude]="location?.coords.latitude" [streetViewControl]="true" [longitude]="location?.coords.longitude" [mapTypeId]="'roadmap'" [zoom]="15">
<agm-marker [label]="location.title" [latitude]=" location?.coords.latitude" [longitude]="location?.coords.longitude" [markerClickable]="true"></agm-marker>
<agm-marker [label]="options" [latitude]="location?.coords.latitude" [longitude]="location?.coords.longitude" [markerClickable]="true"></agm-marker>
</agm-map>
<div id=map></div>
<div #map id=map style="height:100%;"></div>
</ion-content>
\ No newline at end of file
......@@ -3,12 +3,17 @@ page-maps {
background: color($colors, white);
width: 95%;
}
#BUTON {
background: color($colors, vamsi);
}
agm-map {
height: 400px;
width: 320px;
width: auto;
position: absolute;
left: 0;
bottom: 5;
bottom: 0;
top: 0;
right: 0;
}
map {
height: 400px;
......
......@@ -2,6 +2,9 @@ import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams ,Platform} from 'ionic-angular';
import { Geolocation } from '@ionic-native/geolocation';
import { AgmCoreModule } from '@agm/core';
import { variable } from '@angular/compiler/src/output/output_ast';
import {GoogleMap,GoogleMaps,LatLng,CameraPosition,GoogleMapsEvent} from '@ionic-native/google-maps';
/*import {
GoogleMaps,
GoogleMap,
......@@ -27,15 +30,55 @@ import { AgmCoreModule } from '@agm/core';
})
export class MapsPage {
location:any;
public locatio:any;
disabled:boolean;
position:any;
map: GoogleMap;
// map: GoogleMap;
constructor(public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) {
constructor(public navCtrl: NavController, public googleMaps:GoogleMaps,public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) {
this.locatio=[{
title:'V'
}];
var disabled = false;
}
/*
ngAfterViewInit(){
this.platform.ready().then(() => {
this.loadMap();
});
}
loadMap(){
//let element = document.getElementById('map');
this.map = GoogleMaps.create('map_canvas');
//let map:GoogleMap=this.googleMaps.create(element,{});
let latlng=new LatLng(40.7128,74.0059);
this.map.one(GoogleMapsEvent.MAP_READY).then(()=>{
let position:CameraPosition<LatLng>={
target:latlng,
zoom:10,
tilt:30
}
this.map.moveCamera(position);
})
}*/
options={
color: '#ASDF96',
fontFamily: '',
fontSize: '14px',
fontWeight: 'bold',
text:'S',
}
/*loadMap() {
let mapOptions: GoogleMapOptions = {
......@@ -80,6 +123,7 @@ export class MapsPage {
this.geolocation.getCurrentPosition(options).then((location) => {
console.log('Fetched the location successfully',location);
this.location=location;
this.disabled=true;
}).catch((error) => {
console.log('Error getting location', error);
});
......
......@@ -6,48 +6,53 @@
</ion-header>
<ion-content padding id="register">
<ion-list>
<ion-item id="password" style="padding:0px;">
<ion-label floating>NAME</ion-label>
<ion-input type="Email" #username></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Mobile</ion-label>
<ion-input type="tel"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Password</ion-label>
<ion-input type="password" #password minlength="6"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Re-type Password</ion-label>
<ion-input type="password"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Name of the Shop</ion-label>
<ion-input type="text"></ion-input>
</ion-item>
<div class="spacer" style="width: 50px; height: 20px;"></div>
<ion-item style="padding:0px; width:370px">
<ion-label>Shop category</ion-label>
<ion-select id="category" multiple="false">
<ion-option>Kirana</ion-option>
<ion-option>Fancy</ion-option>
<ion-option>Medical</ion-option>
<ion-option>Floral</ion-option>
<ion-option>None</ion-option>
</ion-select>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>LOCATION</ion-label>
<ion-input type="text" value="{{ location?.coords.latitude}} {{ location?.coords.longitude }}" readonly></ion-input>
</ion-item>
<form [formGroup]="register">
<ion-list>
<ion-item id="password" style="padding:0px;">
<ion-label floating>NAME</ion-label>
<ion-input [formControl]="register.controls['name']" type="Email" #username></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Mobile</ion-label>
<ion-input [formControl]="register.controls['mobile']" type="tel"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Password</ion-label>
<ion-input [formControl]="register.controls['password']" type="password" #password minlength="6"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Re-type Password</ion-label>
<ion-input [formControl]="register.controls['retypepassword']" type="password"></ion-input>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>Name of the Shop</ion-label>
<ion-input [formControl]="register.controls['nameofshop']" type="text"></ion-input>
</ion-item>
<div class="spacer" style="width: 50px; height: 20px;"></div>
<ion-item style="padding:0px; width:370px">
<ion-label>Shop category</ion-label>
<ion-select id="category" [formControl]="register.controls['category']" multiple="false">
<ion-option>Kirana</ion-option>
<ion-option>Fancy</ion-option>
<ion-option>Medical</ion-option>
<ion-option>Floral</ion-option>
<ion-option>None</ion-option>
</ion-select>
</ion-item>
<ion-item id="password" style="position: relative; padding:0px;">
<ion-label floating>LOCATION</ion-label>
<ion-input [formControl]="register.controls['location']" type="text" value="{{ location?.coords.latitude}} {{ location?.coords.longitude }}" readonly></ion-input>
</ion-item>
<!--
<!--
%<p> Location:{{ location?.coords.latitude}}/ {{ location?.coords.longitude }} </p>
-->
</ion-list>
</ion-list>
</form>
<div padding>
<button block ion-button color="vamsi" style="padding:0px; width: 100%;" medium (click)="registerUser()">Sign Up</button>
</div>
<div padding>
<button block ion-button color="vamsi" style="padding:0px; width: 100%;" medium (click)="saveEntry()">Sign</button>
</div>
</ion-content>
\ No newline at end of file
......@@ -3,6 +3,8 @@ import { IonicPage, NavController, NavParams ,Platform} from 'ionic-angular';
import { AngularFireAuth } from 'angularfire2/auth';
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';
......@@ -23,15 +25,54 @@ export class RegisterPage {
@ViewChild('username') user;
@ViewChild('password') password;
location:any;
public register:FormGroup;
private baseURI : string = "http://localhost/vamsi/register.php";
constructor(private fire: AngularFireAuth,public navCtrl: NavController, public navParams: NavParams,private geolocation: Geolocation,public platform:Platform) {
constructor(private fire: AngularFireAuth, 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:[''],
password:[''],
retypepassword:[''],
category:[''],
nameofshop:[''],
location:[''],
});
}
createEntry(name : string, mobile : number,password:string,retypepassword:string,nameofshop:string,category:string,location:string) : void
{
let headers : any = new HttpHeaders({ 'Content-Type': 'application/json' }),
options : any = { "key" : "create", "NAME" : name, "MOBILE" : mobile,"PASSWORD":password,"RETYPEPASSWORD":retypepassword,"CATEGORY":category,"SHOPNAME":nameofshop,"LOCATION":location },
url : any = this.baseURI ;
ionViewDidLoad() {
console.log('ionViewDidLoad RegisterPage');
this.http.post(url, JSON.stringify(options), headers)
.subscribe((data : any) =>
{
// If the request was successful notify the user
console.log(`Congratulations the ${name} was successfully added`);
},
(error : any) =>
{
console.log('Something went wrong!');
});
}
saveEntry() : void
{
let name : string = this.register.controls["name"].value,
mobile : number = this.register.controls["mobile"].value,
password : string = this.register.controls["password"].value,
retypepassword:string=this.register.controls["retypepassword"].value,
nameofshop : string = this.register.controls["nameofshop"].value,
category:string=this.register.controls["category"].value,
location : string= this.register.controls["location"].value;
this.createEntry(name,mobile,password,retypepassword,nameofshop,category,location);
}
async registerUser() {
const result=this.fire.auth.createUserWithEmailAndPassword(this.user.value,this.password.value)
.then(result=> {
......@@ -50,5 +91,9 @@ this.geolocation.getCurrentPosition(options).then((location) => {
console.log('Error getting location', error);
});
});
}
ionViewDidLoad() {
console.log('ionViewDidLoad RegisterPage');
}
}
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