Commit 96705627 authored by Gauri Amol Pande's avatar Gauri Amol Pande
Browse files

Merge branch '18-design-feedback-page-2' into 'master'

Resolve "Design Feedback page"

Closes #18

See merge request 92khra1mst/hft_awado_app!36
parents 59521fd5 e40bfdeb
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FeedbackPage } from './feedback.page';
const routes: Routes = [
{
path: '',
component: FeedbackPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class FeedbackPageRoutingModule {}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { FeedbackPageRoutingModule } from './feedback-routing.module';
import { FeedbackPage } from './feedback.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FeedbackPageRoutingModule
],
declarations: [FeedbackPage]
})
export class FeedbackPageModule {}
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
</ion-buttons>
<ion-title slot="start">
Feedback
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<!--form [formGroup]="angForm" novalidate--><div>
<ion-grid>
<ion-row justify-content-center>
<ion-col align-self-center size-md="6" size-lg="5" size-xs="12">
<div padding>
<img src="../../../assets/images/bike2gologo.png">
</div>
<div class="ion-text">
<h3>Feedback</h3>
</div>
<ion-item >
<ion-input type="textarea" [(ngModel)]="content" placeholder="Enter Feedback"></ion-input>
</ion-item>
<div padding>
<ion-button size="large" expand="block" (click)="submitFeedback()">Submit Feedback</ion-button>
</div>
</ion-col>
</ion-row>
</ion-grid>
</div>
<!--/form-->
</ion-content>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { FeedbackPage } from './feedback.page';
describe('FeedbackPage', () => {
let component: FeedbackPage;
let fixture: ComponentFixture<FeedbackPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FeedbackPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(FeedbackPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { RestService } from '../rest.service';
import { UserService } from '../services/user.service';
import { Storage } from '@ionic/storage';
import { Observable } from 'rxjs';
import { FeedbackService } from 'src/app/services/feedback.service';
@Component({
selector: 'app-feedback',
templateUrl: './feedback.page.html',
styleUrls: ['./feedback.page.scss'],
})
export class FeedbackPage implements OnInit {
feedbackApi: Observable<any>;
content: "";
bikeId=this.feedbackService.getBikeid();
constructor(private router: Router,
public httpClient: HttpClient,
public restService: RestService,
public userService: UserService,
private storage: Storage,
public feedbackService: FeedbackService) { }
ngOnInit() {
}
submitFeedback() {
this.storage.get('token').then((token) => {
let url = 'http://193.196.52.237:8081/feedbacks'
const headers = new HttpHeaders().set("Authorization", "Bearer " + token);
this.feedbackApi = this.httpClient.post<any>(url, {"content": this.content,"bikeId":this.bikeId},{headers});
this.feedbackApi.subscribe((resp) => {
console.log("rides response", resp);
//this.loadingService.hideLoader();
}, (error) => {console.log(error)
//this.loadingService.hideLoader();
});
});
}
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ import { Router } from '@angular/router'; ...@@ -10,6 +10,7 @@ import { Router } from '@angular/router';
import { MapDataService } from '../services/map-data.service'; import { MapDataService } from '../services/map-data.service';
import { LocationService } from '../services/location.service'; import { LocationService } from '../services/location.service';
import { LoadingService } from '../services/loading.service'; import { LoadingService } from '../services/loading.service';
import { FeedbackService } from 'src/app/services/feedback.service';
declare var H: any; declare var H: any;
@Component({ @Component({
...@@ -54,6 +55,7 @@ export class HirebikePage implements OnInit { ...@@ -54,6 +55,7 @@ export class HirebikePage implements OnInit {
public rideStarted = false; public rideStarted = false;
constructor(private geolocation: Geolocation, constructor(private geolocation: Geolocation,
public restService: RestService, public restService: RestService,
public httpClient: HttpClient, public httpClient: HttpClient,
...@@ -62,7 +64,8 @@ export class HirebikePage implements OnInit { ...@@ -62,7 +64,8 @@ export class HirebikePage implements OnInit {
private router: Router, private router: Router,
private mapDataService: MapDataService, private mapDataService: MapDataService,
public locationService: LocationService, public locationService: LocationService,
public loadingService: LoadingService) { public loadingService: LoadingService,
public feedbackService: FeedbackService) {
this.platform = new H.service.Platform({ this.platform = new H.service.Platform({
'apikey': 'tiVTgBnPbgV1spie5U2MSy-obhD9r2sGiOCbBzFY2_k' 'apikey': 'tiVTgBnPbgV1spie5U2MSy-obhD9r2sGiOCbBzFY2_k'
...@@ -208,6 +211,7 @@ export class HirebikePage implements OnInit { ...@@ -208,6 +211,7 @@ export class HirebikePage implements OnInit {
this.startRideSubject.next('some value'); this.startRideSubject.next('some value');
this.loadingService.showLoader(); this.loadingService.showLoader();
this.storage.get('token').then((token) => { this.storage.get('token').then((token) => {
const bikeId=this.bikeDetails.id;
let url = 'http://193.196.52.237:8081/rent' + '?bikeId=' + this.bikeDetails.id; let url = 'http://193.196.52.237:8081/rent' + '?bikeId=' + this.bikeDetails.id;
const headers = new HttpHeaders().set("Authorization", "Bearer " + token); const headers = new HttpHeaders().set("Authorization", "Bearer " + token);
let bikeApi = this.httpClient.get(url, { headers }); let bikeApi = this.httpClient.get(url, { headers });
...@@ -240,6 +244,7 @@ export class HirebikePage implements OnInit { ...@@ -240,6 +244,7 @@ export class HirebikePage implements OnInit {
console.log('my data: ', resp); console.log('my data: ', resp);
this.loadingService.hideLoader(); this.loadingService.hideLoader();
this.toastService.showToast("Trip Ended!"); this.toastService.showToast("Trip Ended!");
this.router.navigateByUrl('/feedback');
}, (error) => { }, (error) => {
console.log(error); console.log(error);
this.loadingService.hideLoader(); this.loadingService.hideLoader();
......
import { TestBed } from '@angular/core/testing';
import { FeedbackService } from './feedback.service';
describe('FeedbackService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: FeedbackService = TestBed.get(FeedbackService);
expect(service).toBeTruthy();
});
});
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class FeedbackService {
feedbackBikeDetails = {name : "",bikeid:""}
constructor() { }
public getBikeid(){
return this.feedbackBikeDetails.bikeid
}
public setBikeid (bikeid){
this.feedbackBikeDetails.bikeid = bikeid
}
}
Supports Markdown
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