From 5ef7866a4a413386a0450c25e61e2945a4c942d4 Mon Sep 17 00:00:00 2001
From: Adarsh K <adarsh@techware.in>
Date: Fri, 14 Feb 2020 10:47:05 +0530
Subject: [PATCH] codes-changes

---
 src/app/app.module.ts                         |  5 ++++-
 src/app/catagory/catagory.page.ts             | 19 ++++++++++++++++++-
 src/app/home/home.page.ts                     |  2 ++
 src/app/productdetail/productdetail.page.html |  6 +++---
 src/app/productdetail/productdetail.page.ts   |  1 +
 src/app/productlist/productlist.page.html     |  2 +-
 src/app/searchmodal/searchmodal.page.html     |  3 +--
 src/app/searchmodal/searchmodal.page.ts       |  2 ++
 src/config/order.service.ts                   | 14 +++++++-------
 src/config/safehtml.ts                        | 15 +++++++++++++++
 src/config/services/shopper.ts                |  1 +
 src/config/shopper.service.ts                 |  3 +++
 src/index.html                                |  1 -
 13 files changed, 58 insertions(+), 16 deletions(-)
 create mode 100644 src/config/safehtml.ts

diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 1d5ffdf..b1fbe7f 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -30,6 +30,8 @@ import { FormsModule } from '@angular/forms';
 import { SearchmodalPageModule } from './searchmodal/searchmodal.module';
 import { SocialSharing } from '@ionic-native/social-sharing/ngx';
 import { CallNumber } from '@ionic-native/call-number/ngx';
+import { sanitizeHtmlPipe } from './../config/safehtml';
+
 @NgModule({
   declarations: [AppComponent],
   entryComponents: [],
@@ -57,7 +59,8 @@ import { CallNumber } from '@ionic-native/call-number/ngx';
     ServiceService,
     AuthService,
     GooglePlus,
-    SocialSharing
+    SocialSharing,
+    sanitizeHtmlPipe
   ],
   bootstrap: [AppComponent]
 })
diff --git a/src/app/catagory/catagory.page.ts b/src/app/catagory/catagory.page.ts
index 8a478a2..4fd589f 100644
--- a/src/app/catagory/catagory.page.ts
+++ b/src/app/catagory/catagory.page.ts
@@ -3,6 +3,10 @@ import { Router, ActivatedRoute } from '@angular/router';
 import { Location } from '@angular/common';
 import { CategoriesService } from './../../config/category.service';
 import { ServiceService } from './../../config/service.service';
+import { SearchmodalPage } from '../searchmodal/searchmodal.page';
+import { SubjectService } from './../../config/subject.service';
+import { ModalController } from '@ionic/angular';
+
 
 @Component({
   selector: 'app-catagory',
@@ -15,7 +19,9 @@ export class CatagoryPage implements OnInit {
     public router: Router,
     public location: Location,
     public categoriesService: CategoriesService,
-    public service: ServiceService
+    public service: ServiceService,
+    private subjectService: SubjectService,
+    public modalController: ModalController
   ) {
     this.service.get('params').then((val) => {
       this.data = val;
@@ -35,4 +41,15 @@ export class CatagoryPage implements OnInit {
     this.location.back();
   }
 
+  async searchModal() {
+    this.subjectService.setTabData(false);
+    const modal = await this.modalController.create({
+      component: SearchmodalPage
+    });
+    modal.onDidDismiss().then(dataReturned => {
+      this.subjectService.setTabData(true);
+    });
+    return await modal.present();
+  }
+
 }
diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts
index 388fd29..aaade80 100644
--- a/src/app/home/home.page.ts
+++ b/src/app/home/home.page.ts
@@ -77,10 +77,12 @@ export class HomePage implements OnInit {
   }
 
   private setCurrentLocation() {
+    const This = this;
     if ('geolocation' in navigator) {
       navigator.geolocation.getCurrentPosition(position => {
         this.lat = position.coords.latitude;
         this.lng = position.coords.longitude;
+        this.centerService.getNearBy(this.lat, this.lng, 10);
         this.getAddress(this.lat, this.lng);
       });
     }
diff --git a/src/app/productdetail/productdetail.page.html b/src/app/productdetail/productdetail.page.html
index ddf3fa8..f116121 100644
--- a/src/app/productdetail/productdetail.page.html
+++ b/src/app/productdetail/productdetail.page.html
@@ -39,7 +39,7 @@
     <div class="product_header">
       <ion-row>
         <ion-col size="8">
-          <h3>{{product.prodName}}</h3>
+          <h3 [innerHTML]="product.prodName"></h3>
           <p>
             <strong
               ><span><img src="../assets/Path61_2.png"/></span
@@ -169,7 +169,7 @@
                 </ul>
             </div> -->
       <h5>Description</h5>
-      <p>{{product.prodDesc}}</p>
+      <p [innerHTML]="product.prodDesc"></p>
       <!--<h5>
                 <span class="floatLeft">Reviews</span><span class="floatRight" (click)="goToPage('reviewlist')">MORE</span>
                 <div class="clear"></div>
@@ -256,7 +256,7 @@
                     (click)="changeFav(similar.prodId)"
                   ></div>
                 </div>
-                <h5>{{similar.prodName}}</h5>
+                <h5 [innerHTML]="similar.prodName"></h5>
                 <p>{{similar.price}}</p>
               </li>
             </ion-slide>
diff --git a/src/app/productdetail/productdetail.page.ts b/src/app/productdetail/productdetail.page.ts
index 94cbbb1..fcf1ce0 100644
--- a/src/app/productdetail/productdetail.page.ts
+++ b/src/app/productdetail/productdetail.page.ts
@@ -11,6 +11,7 @@ import { ServiceService } from "./../../config/service.service";
 import { SocialSharing } from "@ionic-native/social-sharing/ngx";
 import { map } from "rxjs/operators";
 
+
 @Component({
   selector: "app-productdetail",
   templateUrl: "./productdetail.page.html",
diff --git a/src/app/productlist/productlist.page.html b/src/app/productlist/productlist.page.html
index 3a714f8..3d37e04 100644
--- a/src/app/productlist/productlist.page.html
+++ b/src/app/productlist/productlist.page.html
@@ -57,7 +57,7 @@
           ></div>
           <div class="featured_badge" *ngIf="product.featured">Featured</div>
         </div>
-        <h5 class="ellipse" (click)="prodDetails(i)">{{product.prodName}}</h5>
+        <h5 class="ellipse" (click)="prodDetails(i)" [innerHTML]="product.prodName"></h5>
         <p (click)="prodDetails(i)">
           A$ {{product.price}}<span class="offer" *ngIf="product.discount > 0"
             >-{{product.discount}}%</span
diff --git a/src/app/searchmodal/searchmodal.page.html b/src/app/searchmodal/searchmodal.page.html
index 2a1c7c9..576ec4f 100644
--- a/src/app/searchmodal/searchmodal.page.html
+++ b/src/app/searchmodal/searchmodal.page.html
@@ -17,8 +17,7 @@
     <li
       *ngFor="let search of searchService.searchList"
       (click)="viewPage(search)"
-    >
-      {{search.text}}
+    [innerHTML]="search.text">
     </li>
   </ul>
 </div>
diff --git a/src/app/searchmodal/searchmodal.page.ts b/src/app/searchmodal/searchmodal.page.ts
index 59a7b45..10ce8bb 100644
--- a/src/app/searchmodal/searchmodal.page.ts
+++ b/src/app/searchmodal/searchmodal.page.ts
@@ -69,5 +69,7 @@ export class SearchmodalPage implements OnInit {
     this.searchShow = false;
   }
 
+  
+
 
 }
diff --git a/src/config/order.service.ts b/src/config/order.service.ts
index 121d037..039a168 100644
--- a/src/config/order.service.ts
+++ b/src/config/order.service.ts
@@ -32,7 +32,7 @@ export class OrdersService {
     this.size = 'small';
     this.color = 'Blue';
     this.custId = '';
-    this.service.get('user').then(data => {
+    this.service.get('userData').then(data => {
       if (data) {
         data = JSON.parse(data);
         this.users = data;
@@ -132,15 +132,15 @@ export class OrdersService {
     // console.log(cartCount);
     const promise = new Promise(resolve => {
       distinctShops.forEach(item => {
-        // console.log(item);
+        console.log(item);
         this.afs
           .collection('orders')
           .add({
+            shopper: firebase.firestore().doc('/shoppers/' + item),
             bookDate: firebase.firestore.FieldValue.serverTimestamp()
           })
           .then(docRef => {
             const neworderId = docRef.id;
-            const delivery = new firebase.firestore.GeoPoint(10.0237, 76.3116);
             const pickup = new firebase.firestore.GeoPoint(10.7231, 76.1234);
             const products = {};
             const cartItem = cartGroup[item];
@@ -168,13 +168,13 @@ export class OrdersService {
               shopper: product.shopper,
               deliveryAddress: otherCharge.custAddress,
               deliveryCharge: 'A$ ' + otherCharge.deliveryCharge,
-              deliveryLocation: delivery,
+              deliveryLocation: otherCharge.custAddress.latLng,
               bookDate: firebase.firestore.FieldValue.serverTimestamp(),
               orderDate: Math.floor(Date.now() / 1000),
               orderCode: this.orderCode(),
               orderId: neworderId,
               orderStatus: 1,
-              pickupAddress: 'GetMi, Canberra, AUS',
+              pickupAddress: '',
               pickupLocation: pickup,
               promoId: null,
               rider: firebase
@@ -184,10 +184,10 @@ export class OrdersService {
               custId: this.custId,
               riderId: 'qbTKza18mWVzYG9NLIbmjMbrYjG2',
               shopperId: product.shopperId,
-              custName: 'Jone Doe',
+              custName:  this.users.name,
               riderName: 'John',
               shopperState: 0,
-              shopperName: 'Witchery',
+              shopperName: '',
               product: products,
               discount: 'A$ ' + otherCharge.discount,
               promoApplied: otherCharge.discountApplied,
diff --git a/src/config/safehtml.ts b/src/config/safehtml.ts
new file mode 100644
index 0000000..c5fe11a
--- /dev/null
+++ b/src/config/safehtml.ts
@@ -0,0 +1,15 @@
+import { Pipe, PipeTransform } from '@angular/core';
+import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
+
+@Pipe({ name: 'sanitizeHtml'})
+
+export class sanitizeHtmlPipe implements PipeTransform  {
+
+  constructor(private _sanitizer:DomSanitizer) { }
+
+  transform(value:string):SafeHtml {    
+    value = value.replace("�", "'");
+    console.log(value);
+    return this._sanitizer.bypassSecurityTrustHtml(value);
+  }
+}
\ No newline at end of file
diff --git a/src/config/services/shopper.ts b/src/config/services/shopper.ts
index 1370835..fb0931e 100644
--- a/src/config/services/shopper.ts
+++ b/src/config/services/shopper.ts
@@ -4,6 +4,7 @@ export interface Shopper {
   phone: string;
   caption: string;
   profilePhoto: string;
+  location: any;
   status: boolean;
   uid: string;
   shopName: string;
diff --git a/src/config/shopper.service.ts b/src/config/shopper.service.ts
index 6f02562..fc091f0 100644
--- a/src/config/shopper.service.ts
+++ b/src/config/shopper.service.ts
@@ -48,6 +48,7 @@ export class ShoppersService {
             workingHours: item.workingHours,
             caption: item.caption,
             centre: item.centre,
+            location: item.location,
             rate: item.rate,
             centerId: item.centerId
           };
@@ -88,6 +89,7 @@ export class ShoppersService {
             workingHours: item.workingHours,
             caption: item.caption,
             centre: item.centre,
+            location: item.location,
             rate: item.rate,
             centerId: item.centerId
           };
@@ -147,6 +149,7 @@ export class ShoppersService {
             workingHours: item.workingHours,
             caption: item.caption,
             centre: item.centre,
+            location: item.location,
             rate: item.rate,
             centerId: item.centerId
           };
diff --git a/src/index.html b/src/index.html
index f271c26..257bf5e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -6,7 +6,6 @@
     <title>Ionic App</title>
 
     <base href="/" />
-
     <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
     <meta name="format-detection" content="telephone=no" />
     <meta name="msapplication-tap-highlight" content="no" />
--
libgit2 0.27.1