Commit bd8d3771 by amalk
parents 56404d5a 120c8b25
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
"ngx-carousel": "^1.3.5", "ngx-carousel": "^1.3.5",
"ngx-gallery": "^5.9.1", "ngx-gallery": "^5.9.1",
"ngx-google-places-autocomplete": "^2.0.3", "ngx-google-places-autocomplete": "^2.0.3",
"ngx-infinite-scroll": "^7.1.0",
"ngx-malihu-scrollbar": "^7.0.0", "ngx-malihu-scrollbar": "^7.0.0",
"ngx-slick": "^0.2.1", "ngx-slick": "^0.2.1",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
width:100%; width:100%;
ul{ ul{
padding:0px; padding:0px;
&::-webkit-scrollbar {
display: none;
}
li{ li{
list-style: none; list-style: none;
background: #fff; background: #fff;
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NgxCarousel } from 'ngx-carousel'; import { NgxCarousel } from 'ngx-carousel';
import { WebService } from '../../provider/web.service';
import { ImageStorage } from '../../../environments/server.config';
import { Router,ActivatedRoute } from '@angular/router'; import { Router,ActivatedRoute } from '@angular/router';
@Component({ @Component({
...@@ -8,21 +10,106 @@ import { Router,ActivatedRoute } from '@angular/router'; ...@@ -8,21 +10,106 @@ import { Router,ActivatedRoute } from '@angular/router';
styleUrls: ['./orders.component.scss'] styleUrls: ['./orders.component.scss']
}) })
export class OrdersComponent implements OnInit { export class OrdersComponent implements OnInit {
page: number = 1;
total_page: number = 1;
loader:boolean;
loginDetails:any;
bookedData: any;
imageServer: string;
trend_loader:boolean;
trendingProductData:any;
public carouselTile: NgxCarousel; public carouselTile: NgxCarousel;
constructor( constructor(
private router : Router, private router : Router,
private route : ActivatedRoute private route : ActivatedRoute,
public webService: WebService,
) { ) {
this.loader = true;
this.trend_loader = true;
this.imageServer = ImageStorage;
} }
ngOnInit() { ngOnInit() {
this.checkUserLogin();
this.getMyOrders();
this.trendingProducts();
this.carouselTile = {grid: {xs: 1, sm: 2 , md: 4, lg: 8, all: 0},slide: 1, speed: 400,point: { visible: false },load: 2, touch: true, easing: 'ease'} this.carouselTile = {grid: {xs: 1, sm: 2 , md: 4, lg: 8, all: 0},slide: 1, speed: 400,point: { visible: false },load: 2, touch: true, easing: 'ease'}
} }
checkUserLogin(){
this.loginDetails = JSON.parse(this.webService.getLocalStorageItem('userData'));
}
getMyOrders(){
this.loader = true;
this.webService.post_data('getMyOrders',{"customer_id":this.loginDetails.customer_id,'page':this.page}).subscribe(response => {
if(response.status == 'success'){
this.total_page = response.meta.total_pages;
this.bookedData = response.data;
} else {
this.bookedData = false;
}
this.loader = false;
})
}
trackOrder(transId){
this.goToPage('track',{"ref":transId});
}
onScroll(){
if(this.total_page < this.page){
return false;
}
this.page += 1;
this.trend_loader = true;
this.webService.post_data('getMyOrders',{"customer_id":this.loginDetails.customer_id,'page':this.page}).subscribe(response => {
if(response.status == 'success'){
let thisObj = this;
response.data.forEach(function(orderData,key) {
thisObj.bookedData.push(orderData);
});
}
this.trend_loader = false;
});
}
cancelOrder(odrId){
if(odrId < 0){
return false;
}
this.loader = true;
this.webService.post_data('cancelOrder',{"order_id":odrId}).subscribe(response => {
if(response.status == 'success'){
this.getMyOrders();
}
this.loader = false;
})
}
trendingProducts(){
this.trend_loader = true;
this.webService.get_data('getTrendingPrdts').subscribe(response => {
if(response.status == 'success'){
this.trendingProductData = response.data;
} else {
this.trendingProductData = false;
}
this.trend_loader = false;
});
}
latestPrdtDtls(prdt_id){
this.goToPage('productdetails',{"product_id":prdt_id});
}
goToPage(path,data=null){ goToPage(path,data=null){
this.router.navigateByUrl(path,{queryParams:data}); this.router.navigate([path],{queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
carouselTileLoad(){ return ''; } carouselTileLoad(){ return ''; }
......
...@@ -70,8 +70,9 @@ ...@@ -70,8 +70,9 @@
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="rate_review" *ngIf="productDetails.reviews"> <div class="rate_review" *ngIf="productDetails.reviews">
<ul> <div class="loader_overlay" *ngIf="review_loader"></div>
<li *ngFor="let revws of productDetails.reviews"> <ul infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false" style="max-height: 700px; overflow: scroll">
<li *ngFor="let revws of reviewArray">
<div class="row"> <div class="row">
<div class="col-md-9"> <div class="col-md-9">
<h4 class="pt0">{{revws.title}}</h4> <h4 class="pt0">{{revws.title}}</h4>
...@@ -106,31 +107,32 @@ ...@@ -106,31 +107,32 @@
</div> </div>
</div> </div>
<div class="bottom_product_list"> <div class="bottom_product_list">
<ngx-carousel [inputs]="carouselTile" (carouselLoad)="carouselTileLoad()"> <div class="loader_overlay" *ngIf="loader2"></div>
<ngx-tile NgxCarouselItem> <!-- LOOP THIS --> <ngx-carousel [inputs]="carouselTile" (carouselLoad)="carouselTileLoad()" *ngIf="trendingProductData">
<li (click)="goToPage('productdetails')"> <ngx-tile NgxCarouselItem *ngFor="let prdt of trendingProductData" >
<li (click)="latestPrdtDtls(prdt.product_id)">
<div class="inner_div_product"> <div class="inner_div_product">
<div class="product_wrapper"> <div class="product_wrapper">
<img src="/assets/images/asset_product.png"> <img src="{{imageServer + prdt.product_image}}" onerror="this.src='assets/images/user_avatar.jpg'">
</div> </div>
<h5>JK Victory Wheelers type</h5> <h5>{{prdt.product_name}}</h5>
<p>265/65 R17, Tubeless</p> <p>{{prdt.short_description}}</p>
<div class="star_ratting"> <div class="star_ratting">
<fieldset class="rating"> <fieldset class="rating" *ngIf="prdt.rating > 0">
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5"></label> <input type="radio" [checked]="(prdt.rating >= 4.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_5'" [attr.name]="'thirdStarName_'+prdt.product_id" value="5" /><label class = "full" for="thirdStar5"></label>
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half"></label> <input type="radio" [checked]="(prdt.rating >= 4.25 && prdt.rating < 4.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_4half'" [attr.name]="'thirdStarName_'+prdt.product_id" value="4.5" /><label class="half" for="thirdStar4half"></label>
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4"></label> <input type="radio" [checked]="(prdt.rating >= 3.75 && prdt.rating < 4.25) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_4'" [attr.name]="'thirdStarName_'+prdt.product_id" value="4" /><label class = "full" for="thirdStar4"></label>
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half"></label> <input type="radio" [checked]="(prdt.rating >= 3.25 && prdt.rating < 3.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_3half'" [attr.name]="'thirdStarName_'+prdt.product_id" value="3.5" /><label class="half" for="thirdStar3half"></label>
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3"></label> <input type="radio" [checked]="(prdt.rating >= 2.75 && prdt.rating < 3.25) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_3'" [attr.name]="'thirdStarName_'+prdt.product_id" value="3" /><label class = "full" for="thirdStar3"></label>
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half"></label> <input type="radio" [checked]="(prdt.rating >= 2.25 && prdt.rating < 2.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_2half'" [attr.name]="'thirdStarName_'+prdt.product_id" value="2.5" /><label class="half" for="thirdStar2half"></label>
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2"></label> <input type="radio" [checked]="(prdt.rating >= 1.75 && prdt.rating < 2.25) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_2'" [attr.name]="'thirdStarName_'+prdt.product_id" value="2" /><label class = "full" for="thirdStar2"></label>
<input type="radio" id="star1half" name="rating" value="1 and a half" /><label class="half" for="star1half"></label> <input type="radio" [checked]="(prdt.rating >= 1.25 && prdt.rating < 1.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_1half'" [attr.name]="'thirdStarName_'+prdt.product_id" value="1.5" /><label class="half" for="thirdStar1half"></label>
<input type="radio" id="star1" name="rating" value="1" /><label class = "full" for="star1"></label> <input type="radio" [checked]="(prdt.rating >= 0.75 && prdt.rating < 1.25) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_1'" [attr.name]="'thirdStarName_'+prdt.product_id" value="1" /><label class = "full" for="thirdStar1"></label>
<input type="radio" id="starhalf" name="rating" value="half" /><label class="half" for="starhalf"></label> <input type="radio" [checked]="(prdt.rating < 0.75) ? 'true':''" [attr.id]="'thirdStar_'+prdt.product_id+'_half'" [attr.name]="'thirdStarName_'+prdt.product_id" value="0.5" /><label class="half" for="thirdStarhalf"></label>
</fieldset> </fieldset>
<span class="floatRight">$320</span> <span class="floatRight">$ {{prdt.amount}}</span>
<div class="clear"></div> <div class="clear"></div>
<p>21 Reviews</p> <p>{{prdt.reviews}} Reviews</p>
</div> </div>
</div> </div>
</li> </li>
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
ul{ ul{
margin:0px; margin:0px;
padding: 0px; padding: 0px;
&::-webkit-scrollbar {
display: none;
}
li{ li{
list-style: none; list-style: none;
border-bottom: 1px solid #eeeeee; border-bottom: 1px solid #eeeeee;
......
...@@ -15,6 +15,8 @@ import * as $ from 'jquery'; ...@@ -15,6 +15,8 @@ import * as $ from 'jquery';
export class ProductdetailsComponent implements OnInit { export class ProductdetailsComponent implements OnInit {
loader: boolean; loader: boolean;
loader2:boolean;
review_loader:boolean;
count:any; count:any;
product_id: number; product_id: number;
imageServer: string; imageServer: string;
...@@ -23,6 +25,10 @@ export class ProductdetailsComponent implements OnInit { ...@@ -23,6 +25,10 @@ export class ProductdetailsComponent implements OnInit {
galleryImages: NgxGalleryImage[]; galleryImages: NgxGalleryImage[];
galleryOptions: NgxGalleryOptions[]; galleryOptions: NgxGalleryOptions[];
loginDetails:any; loginDetails:any;
trendingProductData:any;
page: number = 1;
reviewArray:any = new Array();
total_page: number = 1;
@ViewChild("indexLoginModal") loginModalRef: ElementRef; @ViewChild("indexLoginModal") loginModalRef: ElementRef;
...@@ -33,6 +39,7 @@ export class ProductdetailsComponent implements OnInit { ...@@ -33,6 +39,7 @@ export class ProductdetailsComponent implements OnInit {
public subjectService : SubjectService) { public subjectService : SubjectService) {
this.loader = true; this.loader = true;
this.loader2 = true;
this.count = 1; this.count = 1;
this.product_id = 0; this.product_id = 0;
this.imageServer = ImageStorage; this.imageServer = ImageStorage;
...@@ -61,6 +68,7 @@ export class ProductdetailsComponent implements OnInit { ...@@ -61,6 +68,7 @@ export class ProductdetailsComponent implements OnInit {
this.designModules(); this.designModules();
this.checkUserLogin(); this.checkUserLogin();
this.trendingProducts();
} }
checkUserLogin(){ checkUserLogin(){
...@@ -71,12 +79,15 @@ export class ProductdetailsComponent implements OnInit { ...@@ -71,12 +79,15 @@ export class ProductdetailsComponent implements OnInit {
} }
getProductDetails(){ getProductDetails(){
this.webService.post_data('SingleProductSearch',{"product_id":this.product_id}).subscribe(response => { this.loader = true;
this.webService.post_data('SingleProductSearch',{"product_id":this.product_id,'page':this.page}).subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
let image: string = ''; let image: string = '';
let imageArr: any[] = new Array(); let imageArr: any[] = new Array();
const thisObj = this; const thisObj = this;
this.productDetails = response.data; this.productDetails = response.data;
this.reviewArray = response.data.reviews.data;
this.total_page = response.data.reviews.meta.total_pages;
console.log(response.data) console.log(response.data)
if(this.productDetails.images.length > 0){ if(this.productDetails.images.length > 0){
thisObj.productDetails.images.forEach(function (data) { thisObj.productDetails.images.forEach(function (data) {
...@@ -95,6 +106,36 @@ export class ProductdetailsComponent implements OnInit { ...@@ -95,6 +106,36 @@ export class ProductdetailsComponent implements OnInit {
}); });
} }
onScroll(){
if(this.total_page < this.page){
return false;
}
this.page += 1;
this.review_loader = true;
this.webService.post_data('SingleProductSearch',{"product_id":this.product_id,'page':this.page}).subscribe(response => {
if(response.status == 'success'){
let thisObj = this;
response.data.reviews.data.forEach(function(reviewData,key) {
thisObj.reviewArray.push(reviewData);
});
}
this.review_loader = false;
});
}
trendingProducts(){
this.loader2 = true;
this.webService.post_data('getTrendingPrdts',{'page':this.page}).subscribe(response => {
if(response.status == 'success'){
this.trendingProductData = response.data;
} else {
this.trendingProductData = false;
}
this.loader2 = false;
});
}
buyProduct(amount){ buyProduct(amount){
if(!this.loginDetails){ if(!this.loginDetails){
this.loginModalRef.nativeElement.click(); this.loginModalRef.nativeElement.click();
...@@ -104,6 +145,10 @@ export class ProductdetailsComponent implements OnInit { ...@@ -104,6 +145,10 @@ export class ProductdetailsComponent implements OnInit {
this.webService.setLocalStorageItem('productDetails', JSON.stringify(this.product_data)); this.webService.setLocalStorageItem('productDetails', JSON.stringify(this.product_data));
this.goToPage('address',''); this.goToPage('address','');
} }
latestPrdtDtls(prdt_id){
this.goToPage('productdetails',{"product_id":prdt_id});
}
goToPage(path,data=null){ goToPage(path,data=null){
this.router.navigate([path],{queryParams: data}); this.router.navigate([path],{queryParams: data});
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</div> </div>
<div class="loader_overlay" *ngIf="loader"></div> <div class="loader_overlay" *ngIf="loader"></div>
<div class="search_listing_content" *ngIf="productArray && productArray.length > 0;else noProductData"> <div class="search_listing_content" *ngIf="productArray && productArray.length > 0;else noProductData">
<ul> <ul infiniteScroll [infiniteScrollDistance]="2" [infiniteScrollThrottle]="50" (scrolled)="onScroll()" [scrollWindow]="false" style="max-height: 700px; overflow: scroll">
<li *ngFor="let prdt of productArray"> <li *ngFor="let prdt of productArray">
<div class="inner_div_product cpoint" (click)="getSingleProductDetails(prdt.product_id)"> <div class="inner_div_product cpoint" (click)="getSingleProductDetails(prdt.product_id)">
<div class="product_wrapper"> <div class="product_wrapper">
......
...@@ -233,6 +233,9 @@ ...@@ -233,6 +233,9 @@
ul{ ul{
margin:0px; margin:0px;
padding:0px; padding:0px;
&::-webkit-scrollbar {
display: none;
}
li{ li{
list-style: none; list-style: none;
padding:10px; padding:10px;
......
...@@ -13,12 +13,15 @@ export class ProductlistComponent implements OnInit { ...@@ -13,12 +13,15 @@ export class ProductlistComponent implements OnInit {
loader: boolean; loader: boolean;
searchKey:string; searchKey:string;
imageServer: any; imageServer: any;
productArray: any; productArray: any[] = new Array();
productBrand: any; productBrand: any;
brandArr: any[] = new Array(); brandArr: any[] = new Array();
sliderMinvalue: number; sliderMinvalue: number;
sliderhighValue: number; sliderhighValue: number;
slideroptions: Options; slideroptions: Options;
page: number = 1;
total_page: number = 1;
filterParam: any = new Array();
constructor( constructor(
private router : Router, private router : Router,
...@@ -26,13 +29,16 @@ export class ProductlistComponent implements OnInit { ...@@ -26,13 +29,16 @@ export class ProductlistComponent implements OnInit {
public webService : WebService public webService : WebService
){ ){
this.loader = true; this.loader = true;
this.productArray = true; this.productArray = [];
this.filterParam = {"key":'',"brand_id":Array(),"minPrice":'',"maxPrice":'','page':1};
this.imageServer = ImageStorage; this.imageServer = ImageStorage;
route.params.subscribe(val => { route.params.subscribe(val => {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.searchKey = params['key']; this.searchKey = params['key'];
this.getProductDetails({"key":this.searchKey}); this.filterParam.key = this.searchKey;
this.filterParam.page = this.page;
this.getProductDetails(this.filterParam);
}); });
}); });
if(this.searchKey == ''){ if(this.searchKey == ''){
...@@ -51,14 +57,22 @@ export class ProductlistComponent implements OnInit { ...@@ -51,14 +57,22 @@ export class ProductlistComponent implements OnInit {
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
getProductDetails(params:any = ''){ getProductDetails(params:any = Array()){
this.loader = true; this.loader = true;
this.webService.post_data('productSearch',params).subscribe(response => { this.webService.post_data('productSearch',params).subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
console.log(response.data); this.total_page = response.meta.total_pages;
this.productArray = response.data; if(params.page == 1){
this.productArray = response.data;
} else {
let thisObj = this;
response.data.forEach(function(product,key) {
thisObj.productArray.push(product);
});
}
} else { } else {
this.productArray = false; this.productArray = [];
} }
this.loader = false; this.loader = false;
}); });
...@@ -75,6 +89,15 @@ export class ProductlistComponent implements OnInit { ...@@ -75,6 +89,15 @@ export class ProductlistComponent implements OnInit {
}); });
} }
onScroll(){
if(this.total_page == this.page){
return false;
}
this.page += 1;
this.filterParam.page = this.page;
this.getProductDetails(this.filterParam);
}
getSingleProductDetails(prdt_id){ getSingleProductDetails(prdt_id){
this.goToPage('productdetails',{"product_id":prdt_id}); this.goToPage('productdetails',{"product_id":prdt_id});
} }
...@@ -88,10 +111,17 @@ export class ProductlistComponent implements OnInit { ...@@ -88,10 +111,17 @@ export class ProductlistComponent implements OnInit {
this.brandArr.splice(id, 1); this.brandArr.splice(id, 1);
} }
} }
this.getProductDetails({"key":this.searchKey,"brand_id":this.brandArr}); this.page = 1;
this.filterParam.page = this.page;
this.filterParam.brand_id = this.brandArr;
this.getProductDetails(this.filterParam);
} }
getPrice(low,top){ getPrice(low,top){
this.getProductDetails({"key":this.searchKey,"brand_id":this.brandArr,"minPrice":low,"maxPrice":top}); this.page = 1;
this.filterParam.page = this.page;
this.filterParam.minPrice = low;
this.filterParam.maxPrice = top;
this.getProductDetails(this.filterParam);
} }
} }
...@@ -233,6 +233,9 @@ ...@@ -233,6 +233,9 @@
ul{ ul{
margin:0px; margin:0px;
padding:0px; padding:0px;
&::-webkit-scrollbar {
display: none;
}
li{ li{
list-style: none; list-style: none;
padding:10px; padding:10px;
...@@ -470,4 +473,26 @@ ...@@ -470,4 +473,26 @@
} }
} }
} }
}
.status_modal{
border-radius: 0px;
.modal-header{
border:none;
}
.login_modal_inner{
img{
width:75px;
}
h4{
font-size:18px;
}
.log_btn{
background: #2655bf;
color: #fff;
border:none;
border-radius: 0px;
}
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild, ElementRef} from '@angular/core'; ...@@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild, ElementRef} from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router'; import { Router,ActivatedRoute } from '@angular/router';
import { WebService } from '../../provider/web.service'; import { WebService } from '../../provider/web.service';
import { Options } from 'ng5-slider'; import { Options } from 'ng5-slider';
import { ImageStorage } from '../../../environments/server.config';
import { NgxCarousel } from 'ngx-carousel'; import { NgxCarousel } from 'ngx-carousel';
@Component({ @Component({
...@@ -11,6 +12,14 @@ import { NgxCarousel } from 'ngx-carousel'; ...@@ -11,6 +12,14 @@ import { NgxCarousel } from 'ngx-carousel';
}) })
export class PurchaseHomeComponent implements OnInit { export class PurchaseHomeComponent implements OnInit {
public carouselTile: NgxCarousel; public carouselTile: NgxCarousel;
page: number = 1;
loader:boolean;
total_page: number = 1;
imageServer: any;
trend_loader:boolean;
latestProductData:any;
trendingProductData:any;
@ViewChild("failureModel") public failureModelRef: ElementRef; @ViewChild("failureModel") public failureModelRef: ElementRef;
...@@ -18,7 +27,11 @@ export class PurchaseHomeComponent implements OnInit { ...@@ -18,7 +27,11 @@ export class PurchaseHomeComponent implements OnInit {
private router : Router, private router : Router,
private route : ActivatedRoute, private route : ActivatedRoute,
public webService : WebService public webService : WebService
) { } ) {
this.loader = true;
this.trend_loader = true;
this.imageServer = ImageStorage;
}
value: number = 40; value: number = 40;
highValue: number = 60; highValue: number = 60;
...@@ -37,16 +50,65 @@ export class PurchaseHomeComponent implements OnInit { ...@@ -37,16 +50,65 @@ export class PurchaseHomeComponent implements OnInit {
} }
}); });
this.unsetProdDetails(); this.unsetProdDetails();
this.carouselTile = {grid: {xs: 1, sm: 2 , md: 4, lg: 8, all: 0},slide: 1, speed: 400,point: { visible: false },load: 2, touch: true, easing: 'ease'} this.getLatestProducts();
this.trendingProducts();
this.carouselTile = {grid: {xs: 1, sm: 2, md: 4, lg: 8, all: 0},slide: 1, speed: 400, point: { visible: false }, load: 2, touch: true, loop: true}
} }
unsetProdDetails(){ unsetProdDetails(){
this.webService.removeLocalItem('productDetails'); this.webService.removeLocalItem('productDetails');
} }
getLatestProducts(){
this.loader = true;
this.webService.get_data('getLatestPrdts').subscribe(response => {
if(response.status == 'success'){
this.latestProductData = response.data;
} else {
this.latestProductData = false;
}
this.loader = false;
});
}
trendingProducts(){
this.trend_loader = true;
this.webService.post_data('getTrendingPrdts',{'page':this.page}).subscribe(response => {
if(response.status == 'success'){
this.total_page = response.meta.total_pages;
this.trendingProductData = response.data;
} else {
this.trendingProductData = false;
}
this.trend_loader = false;
});
}
latestPrdtDtls(prdt_id){
this.goToPage('productdetails',{"product_id":prdt_id});
}
onScroll(){
if(this.total_page < this.page){
return false;
}
this.page += 1;
this.trend_loader = true;
this.webService.post_data('getTrendingPrdts',{'page':this.page}).subscribe(response => {
if(response.status == 'success'){
let thisObj = this;
response.data.forEach(function(trendData,key) {
thisObj.trendingProductData.push(trendData);
});
}
this.trend_loader = false;
});
}
goToPage(path,data=null){ goToPage(path,data=null){
this.router.navigateByUrl(path,{queryParams:data}); this.router.navigate([path],{queryParams: data});
document.body.scrollTop = document.documentElement.scrollTop = 0; document.body.scrollTop = document.documentElement.scrollTop = 0;
} }
carouselTileLoad(){ return ''; } carouselTileLoad(){ return ''; }
......
...@@ -5,6 +5,7 @@ import { ProductlistComponent } from './productlist/productlist.component'; ...@@ -5,6 +5,7 @@ import { ProductlistComponent } from './productlist/productlist.component';
import { ProductdetailsComponent } from './productdetails/productdetails.component'; import { ProductdetailsComponent } from './productdetails/productdetails.component';
import { moduleRouting } from './purchase.routing'; import { moduleRouting } from './purchase.routing';
import { SearchbarComponent } from './searchbar/searchbar.component'; import { SearchbarComponent } from './searchbar/searchbar.component';
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { Ng5SliderModule } from 'ng5-slider'; import { Ng5SliderModule } from 'ng5-slider';
import { MalihuScrollbarModule } from 'ngx-malihu-scrollbar'; import { MalihuScrollbarModule } from 'ngx-malihu-scrollbar';
import { NgxGalleryModule } from 'ngx-gallery'; import { NgxGalleryModule } from 'ngx-gallery';
...@@ -30,6 +31,7 @@ import { PurchaseHomeComponent } from './purchase-home/purchase-home.component'; ...@@ -30,6 +31,7 @@ import { PurchaseHomeComponent } from './purchase-home/purchase-home.component';
NgxGalleryModule, NgxGalleryModule,
NgxCarouselModule, NgxCarouselModule,
ReactiveFormsModule, ReactiveFormsModule,
InfiniteScrollModule,
TooltipModule, TooltipModule,
MalihuScrollbarModule.forRoot() MalihuScrollbarModule.forRoot()
] ]
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="bottom_product_list"> <!-- <div class="bottom_product_list">
<h4>Audi Q7 <span>( Similar Results )</span></h4> <h4>Audi Q7 <span>( Similar Results )</span></h4>
<ngx-carousel [inputs]="carouselTile" (carouselLoad)="carouselTileLoad()"> <ngx-carousel [inputs]="carouselTile" (carouselLoad)="carouselTileLoad()">
<ngx-tile NgxCarouselItem> <ngx-tile NgxCarouselItem>
...@@ -472,5 +472,5 @@ ...@@ -472,5 +472,5 @@
<button NgxCarouselPrev class='leftRs'>&lt;</button> <button NgxCarouselPrev class='leftRs'>&lt;</button>
<button NgxCarouselNext class='rightRs'>&gt;</button> <button NgxCarouselNext class='rightRs'>&gt;</button>
</ngx-carousel> </ngx-carousel>
</div> </div> -->
</div> </div>
\ No newline at end of file
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
</ul> </ul>
</div> </div>
<div *ngIf="productArray && productArray.length > 0" class="nav_bar_search_list"> <div *ngIf="productArray && productArray.length > 0" class="nav_bar_search_list">
<ul class="filter-select"> <ul class="filter-select" malihu-scrollbar [scrollbarOptions]="scrollbarOptions" style="max-height: 350px; overflow: scroll">
<li class="cpoint" *ngFor="let prdt of productArray" (click)="clickProduct(prdt.product_id)"> <li class="cpoint" *ngFor="let prdt of productArray" (click)="clickProduct(prdt.product_id)">
<div class="search_list_image"></div> <div class="search_list_image">
<img src="{{imageServer + prdt.image}}" onerror="this.src='assets/images/user_avatar.jpg'">
</div>
<p>{{prdt.product_name}}</p> <p>{{prdt.product_name}}</p>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
......
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core'; import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router'; import { Router,ActivatedRoute } from '@angular/router';
import { WebService } from '../../provider/web.service'; import { WebService } from '../../provider/web.service';
import { ImageStorage } from '../../../environments/server.config';
@Component({ @Component({
selector: 'app-searchbar', selector: 'app-searchbar',
...@@ -11,10 +12,15 @@ export class SearchbarComponent implements OnInit { ...@@ -11,10 +12,15 @@ export class SearchbarComponent implements OnInit {
productArray: any; productArray: any;
SingleProductData:any; SingleProductData:any;
imageServer: string;
public scrollbarOptions = { axis: 'y', theme: 'minimal-dark' };
@ViewChild("productSearch") public productSearchRef: ElementRef; @ViewChild("productSearch") public productSearchRef: ElementRef;
constructor(private router : Router, private route: ActivatedRoute, public webService: WebService) { constructor(private router : Router, private route: ActivatedRoute, public webService: WebService) {
this.productArray = true; this.productArray = true;
this.imageServer = ImageStorage;
} }
ngOnInit() { ngOnInit() {
...@@ -32,11 +38,11 @@ export class SearchbarComponent implements OnInit { ...@@ -32,11 +38,11 @@ export class SearchbarComponent implements OnInit {
} }
this.webService.post_data('productSearch',{"key":product}).subscribe(response => { this.webService.post_data('productSearch',{"key":product}).subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
console.log(response.data)
this.productArray = response.data; this.productArray = response.data;
} else { } else {
this.productArray = false; this.productArray = false;
} }
console.log(this.productArray);
}); });
} }
......
...@@ -91,9 +91,9 @@ export class SummaryComponent implements OnInit { ...@@ -91,9 +91,9 @@ export class SummaryComponent implements OnInit {
if(response.status == 'success'){ if(response.status == 'success'){
document.location.href = this.serverUrl+'orderPayNow/'+response.data; document.location.href = this.serverUrl+'orderPayNow/'+response.data;
}else{ }else{
this.loader = false;
this.failureModelRef.nativeElement.click(); this.failureModelRef.nativeElement.click();
} }
this.loader = false;
}) })
} }
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
} }
.order_range{ .order_range{
height:200px; height:207px;
padding-top: 20px; padding-top: 20px;
width:30px; width:30px;
float: left; float: left;
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
.order_range_details{ .order_range_details{
float: left; float: left;
width:calc(100% - 30px); width:calc(100% - 30px);
height:200px; height:221px;
padding-top: 20px; padding-top: 20px;
padding-left: 20px; padding-left: 20px;
position: relative; position: relative;
...@@ -107,19 +107,19 @@ ...@@ -107,19 +107,19 @@
span{ span{
position: absolute; position: absolute;
&:nth-child(1) { &:nth-child(1) {
top:8%; top:7%;
} }
&:nth-child(2) {
&:nth-child(2) { top:32%;
top:48%; }
} &:nth-child(3) {
top:57%;
&:nth-child(3) { }
bottom:0%; &:nth-child(4) {
} top:82%;
}
} }
h5{ h5{
margin:0px; margin:0px;
padding:0px; padding:0px;
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
} }
.order_delivery_details{ .order_delivery_details{
padding-top: 30px; padding-top: 55px;
padding-bottom: 30px; padding-bottom: 30px;
.order_id{ .order_id{
color: #000000; color: #000000;
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { Router,ActivatedRoute } from '@angular/router'; import { Router,ActivatedRoute } from '@angular/router';
import { WebService } from '../../provider/web.service'; import { WebService } from '../../provider/web.service';
import { NgxGalleryOptions, NgxGalleryImage, NgxGalleryAnimation } from 'ngx-gallery'; import { NgxGalleryOptions, NgxGalleryImage, NgxGalleryAnimation } from 'ngx-gallery';
import * as $ from 'jquery'; import { FormGroup, FormControl, Validators, ValidationErrors } from '@angular/forms';
import { ValidationService } from '../../provider/validation.service';
import { NgxCarousel } from 'ngx-carousel'; import { NgxCarousel } from 'ngx-carousel';
import { ImageStorage } from '../../../environments/server.config'; import { ImageStorage } from '../../../environments/server.config';
import { Options } from 'ng5-slider'; import { Options } from 'ng5-slider';
import * as $ from 'jquery';
interface RangeSliderModel { interface RangeSliderModel {
minValue: number; minValue: number;
...@@ -23,36 +25,50 @@ export class TrackComponent implements OnInit { ...@@ -23,36 +25,50 @@ export class TrackComponent implements OnInit {
count:any; count:any;
loginDetails:any; loginDetails:any;
loader:boolean; loader:boolean;
loader_review:boolean;
imageServer: string; imageServer: string;
orderDetails:any; orderDetails:any;
userReviewed:boolean;
galleryOptions: NgxGalleryOptions[]; galleryOptions: NgxGalleryOptions[];
galleryImages: NgxGalleryImage[]; galleryImages: NgxGalleryImage[];
verticalSlider2:any;
rateFormClick:boolean;
rateFormResponse:any;
@ViewChild('ratingModal') ratingModal: ElementRef;
public carouselTile: NgxCarousel; public carouselTile: NgxCarousel;
constructor(private router : Router, constructor(private router : Router,
private route : ActivatedRoute, private route : ActivatedRoute,
public errorMsg : ValidationService,
public webService : WebService){ public webService : WebService){
this.count = 0; this.count = 0;
this.loader =true; this.loader = true;
this.imageServer = ImageStorage; this.userReviewed = true;
this.loader_review = false;
this.imageServer = ImageStorage;
this.rateFormClick = false;
} }
rateForm;
ngOnInit(): void { ngOnInit(): void {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
let payStatus = params['status'];
this.ref_id = params['ref']; this.ref_id = params['ref'];
if(!this.ref_id || this.ref_id < 0){
if(payStatus && payStatus !=''){ this.goToPage('purchaseHome','');
if(payStatus == 'success'){
if(this.ref_id > 0){
this.getOrderDetail();
}
}
} }
}); });
this.designModule(); this.designModule();
this.getOrderDetail();
this.checkUserLogin(); this.checkUserLogin();
this.unsetProdDetails(); this.unsetProdDetails();
this.rateForm = new FormGroup({
rating: new FormControl('5'),
title: new FormControl('',[Validators.required]),
description: new FormControl('',[Validators.required])
});
} }
checkUserLogin(){ checkUserLogin(){
...@@ -66,10 +82,42 @@ export class TrackComponent implements OnInit { ...@@ -66,10 +82,42 @@ export class TrackComponent implements OnInit {
this.webService.removeLocalItem('productDetails'); this.webService.removeLocalItem('productDetails');
} }
getOrderDetail(){ rateFormSubmit(data){
if(this.ref_id <= 0){ if(this.rateForm.invalid){
this.goToPage('purchaseHome',''); return false;
} }
data.product_id = this.orderDetails.product_id;
data.customer_id = this.loginDetails.customer_id;
this.loader_review = true;
const This = this;
this.webService.post_data('rateProduct',data).subscribe(response => {
if(response.status == 'success'){
this.rateFormResponse = response;
this.userReviewed = true;
setTimeout( function() {
This.rateFormResponse = false;
This.ratingModal.nativeElement.click();
}, 3000);
}else{
response.status = 'error';
response.message = (response.message == '')?this.errorMsg.errorList.req_failure:response.message;
this.rateFormResponse = response;
setTimeout( function() {
This.rateFormResponse = false;
}, 3000);
}
this.loader_review = false;
},error => {
this.rateFormResponse = {'status':'error','message':this.errorMsg.errorList.req_failure};
setTimeout( function() {
This.rateFormResponse = false;
}, 3000);
this.loader_review = false;
});
}
getOrderDetail(){
this.loader = true; this.loader = true;
this.webService.post_data('getOrderDetail',{'ref_id':this.ref_id}).subscribe(response => { this.webService.post_data('getOrderDetail',{'ref_id':this.ref_id}).subscribe(response => {
if(response.status == 'success'){ if(response.status == 'success'){
...@@ -77,6 +125,8 @@ export class TrackComponent implements OnInit { ...@@ -77,6 +125,8 @@ export class TrackComponent implements OnInit {
let imageArr: any[] = new Array(); let imageArr: any[] = new Array();
const thisObj = this; const thisObj = this;
this.orderDetails = response.data; this.orderDetails = response.data;
this.userReviewed = (this.orderDetails.review_id <= 0 && (this.orderDetails.odr_status == '5' || this.orderDetails.odr_status == '6' || this.orderDetails.odr_status == '7'))?false:true;
console.log(this.userReviewed);
if(this.orderDetails.images.length > 0){ if(this.orderDetails.images.length > 0){
thisObj.orderDetails.images.forEach(function (data) { thisObj.orderDetails.images.forEach(function (data) {
image = thisObj.imageServer + data.image; image = thisObj.imageServer + data.image;
...@@ -87,6 +137,19 @@ export class TrackComponent implements OnInit { ...@@ -87,6 +137,19 @@ export class TrackComponent implements OnInit {
imageArr.push({small: image,medium: image,big: image}); imageArr.push({small: image,medium: image,big: image});
} }
this.galleryImages = imageArr; this.galleryImages = imageArr;
if(this.orderDetails.odr_status === '2'){
this.verticalSlider2 = { minValue: 50, maxValue: 50, options: { floor: 0, ceil: 50, vertical: true } };
}
else if(this.orderDetails.odr_status ==='3'){
this.verticalSlider2 = { minValue: 50, maxValue: 76, options: { floor: 0, ceil: 76, vertical: true } };
}
else if(this.orderDetails.odr_status ==='4'){
this.verticalSlider2 = { minValue: 50, maxValue: 152, options: { floor: 0, ceil: 152, vertical: true } };
}
else if(this.orderDetails.odr_status === '5'){
this.verticalSlider2 = { minValue: 50, maxValue: 10000000, options: { floor: 0, ceil: 10000000, vertical: true } };
}
}else{ }else{
this.orderDetails = false; this.orderDetails = false;
this.goToPage('purchaseHome',''); this.goToPage('purchaseHome','');
...@@ -110,7 +173,6 @@ export class TrackComponent implements OnInit { ...@@ -110,7 +173,6 @@ export class TrackComponent implements OnInit {
carouselTileLoad(){ return ''; } carouselTileLoad(){ return ''; }
add(){this.count = this.count + 1;} add(){this.count = this.count + 1;}
minus(){ this.count = this.count - 1; if(this.count < 0){ this.count = 0; }} minus(){ this.count = this.count - 1; if(this.count < 0){ this.count = 0; }}
verticalSlider2: RangeSliderModel = { minValue: 50, maxValue: 100, options: { floor: 0, ceil: 100, vertical: true } };
designModule(){ designModule(){
this.carouselTile = {grid: {xs: 1, sm: 2 , md: 4, lg: 8, all: 0},slide: 1, speed: 400,point: { visible: false },load: 2, touch: true, easing: 'ease'} this.carouselTile = {grid: {xs: 1, sm: 2 , md: 4, lg: 8, all: 0},slide: 1, speed: 400,point: { visible: false },load: 2, touch: true, easing: 'ease'}
......
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