-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complaints suggestions #49
base: master
Are you sure you want to change the base?
Changes from 17 commits
bc78eef
d0ab16a
9ce0d43
805109f
a8e5d0c
bd50c25
d3873d0
f0b5e51
d94fdfb
825dbbc
58db2e8
60aec58
ef3e8c6
ab90d2b
e5fb7d1
fa6d142
659389a
bc6f9f9
076a2df
f061836
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,13 @@ import { RedirComponent } from './redir/redir.component'; | |
import { UpdateRoleComponent } from './update-role/update-role.component'; | ||
import { CardComponent } from './card/card.component'; | ||
|
||
import { ComplaintsHomeComponent } from './venter/complaints-home/complaints-home.component'; | ||
import { FileComplaintComponent } from './venter/file-complaint/file-complaint.component'; | ||
import { DetailedComplaintComponent } from './venter/detailed-complaint/detailed-complaint.component'; | ||
import { EditCommentComponent } from './venter/edit-comment/edit-comment.component'; | ||
import { VenterDataService } from './venter/venter-data.service'; | ||
import { ComplaintCardComponent } from './venter/complaint-card/complaint-card.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
AppComponent, | ||
|
@@ -91,7 +98,12 @@ import { CardComponent } from './card/card.component'; | |
NotifyCardComponent, | ||
RedirComponent, | ||
UpdateRoleComponent, | ||
CardComponent | ||
CardComponent, | ||
ComplaintsHomeComponent, | ||
FileComplaintComponent, | ||
DetailedComplaintComponent, | ||
EditCommentComponent, | ||
ComplaintCardComponent, | ||
], | ||
imports: [ | ||
BrowserModule, | ||
|
@@ -100,6 +112,7 @@ import { CardComponent } from './card/card.component'; | |
HttpClientModule, | ||
FormsModule, | ||
BrowserAnimationsModule, | ||
MyMaterialClass, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already imported on line 157 |
||
|
||
ImgFallbackModule, | ||
MarkdownModule.forRoot(), | ||
|
@@ -120,7 +133,6 @@ import { CardComponent } from './card/card.component'; | |
{ path: 'quick-links', component: QuickLinksComponent, data: { state: 'base' } }, | ||
{ path: 'settings', component: SettingsComponent, data: { state: 'base' } }, | ||
{ path: 'about', component: AboutComponent, data: { state: 'overlay' } }, | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whitespace was intentional |
||
{ path: 'add-event', component: AddEventComponent, data: { state: 'overlay' }, canActivate: [LoginActivate] }, | ||
{ path: 'edit-event/:id', component: AddEventComponent, data: { state: 'overlay' }, canActivate: [LoginActivate] }, | ||
{ path: 'edit-body/:id', component: UpdateBodyComponent, data: { state: 'overlay' }, canActivate: [LoginActivate] }, | ||
|
@@ -131,6 +143,11 @@ import { CardComponent } from './card/card.component'; | |
|
||
{ path: 'blog/:blog', component: BlogComponent, data: { state: 'base' }, canActivate: [LoginActivate] }, | ||
{ path: 'login', component: LoginComponent, data: { state: 'base' } }, | ||
|
||
{ path: 'venter/complaints-home', component: ComplaintsHomeComponent, data: { state: 'base' } }, | ||
{ path: 'venter/file-complaint', component: FileComplaintComponent, data: { state: 'base' } }, | ||
{ path: 'venter/detailed-complaint/:id', component: DetailedComplaintComponent, data: { state: 'base' } }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These paths are user-facing and hence should not be so verbose. Just change to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add |
||
|
||
{ path: 'feedback', component: RedirComponent, data: { state: 'base' } }, | ||
{ path: 'android', component: RedirComponent, data: { state: 'base' } }, | ||
{ path: '**', redirectTo: 'feed' }, | ||
|
@@ -141,12 +158,14 @@ import { CardComponent } from './card/card.component'; | |
LayoutModule, | ||
], | ||
entryComponents: [ | ||
NotifyCardComponent | ||
NotifyCardComponent, | ||
EditCommentComponent | ||
], | ||
providers: [ | ||
DataService, | ||
{ provide: RouteReuseStrategy, useClass: CustomReuseStrategy }, | ||
LoginActivate, | ||
VenterDataService, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this just below |
||
], | ||
bootstrap: [AppComponent] | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,6 +162,60 @@ export interface IUserTagCategory { | |
tags: IUserTag[]; | ||
} | ||
|
||
export interface IComplaintTagUri { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to |
||
id: string; | ||
tag_uri: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Identifier 'tag_uri' is not in camel case. |
||
} | ||
|
||
export interface IComplaintComment { | ||
id: string; | ||
time: string; | ||
text: string; | ||
commented_by: IUserProfile; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Identifier 'commented_by' is not in camel case. |
||
reported_date: string; | ||
} | ||
|
||
export interface IComplaint { | ||
id: string; | ||
created_by: IUserProfile; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Identifier 'created_by' is not in camel case. |
||
description: string; | ||
suggestions: string; | ||
location_details: string; | ||
report_date: string; | ||
reported_date: string; | ||
status: string; | ||
status_color: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Identifier 'status_color' is not in camel case. |
||
latitude: number; | ||
longitude: number; | ||
location_description: string; | ||
tags: IComplaintTagUri; | ||
users_up_voted: IUserProfile[]; | ||
images: string[]; | ||
comments: IComplaintComment[]; | ||
vote_count: number; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Identifier 'vote_count' is not in camel case. |
||
is_subscribed: number; | ||
upvoted: boolean; | ||
} | ||
|
||
export interface IComplaintPost { | ||
description: string; | ||
suggestions: string; | ||
location_details: string; | ||
latitude: number; | ||
longitude: number; | ||
location_description: string; | ||
tags: string[]; | ||
images: string[]; | ||
} | ||
|
||
export interface IPostComment { | ||
text: string; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need separate interfaces for posting. Reuse |
||
|
||
export interface ICommentDialogData { | ||
commentId: string; | ||
comment: string; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just use the |
||
export interface IInstituteRole { | ||
id: string; | ||
name: string; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.complaint-card { | ||
text-decoration: none; | ||
} | ||
|
||
.complaint-divider { | ||
padding: 1%; | ||
} | ||
|
||
.complaint-card-content { | ||
font-size: medium; | ||
padding-top: 3%; | ||
} | ||
|
||
.complaint-description { | ||
white-space: pre-wrap; | ||
} | ||
|
||
.complaint-location-details { | ||
padding-top: 2%; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Expected indentation of 2 spaces (indentation) |
||
} | ||
|
||
.card { | ||
margin: 5%; | ||
width: 80%; | ||
} | ||
|
||
.footer { | ||
position: relative; | ||
text-align: center; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Expected indentation of 2 spaces (indentation) |
||
} | ||
|
||
.footer-button-container { | ||
display: inline; | ||
} | ||
|
||
.complaint-upvote-active { | ||
color: #536dfe; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Expected indentation of 2 spaces (indentation) |
||
} | ||
|
||
.status { | ||
float: right; | ||
background-color: red; | ||
border-width: medium; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Expected indentation of 2 spaces (indentation) |
||
color: white; | ||
padding: 0 2.5%; | ||
font-weight: bold; | ||
text-transform: uppercase; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue found: Expected indentation of 2 spaces (indentation) |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newline at EOF There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for all other files. You can configure most text editors to do this for you. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<div class="complaint-card" *ngFor="let complaint of complaintList; let i = index"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<mat-card class="card" [routerLink]="['/venter/detailed-complaint', complaint.id]"> | ||
<div class="status" [style.backgroundColor]="complaint.status_color"> | ||
{{ complaint.status }} | ||
</div> | ||
<mat-card-header> | ||
<img mat-card-avatar src="{{complaint.created_by.profile_pic}}" | ||
src-fallback="assets/add_image_placeholder.svg"> | ||
<mat-card-title>{{ complaint.created_by.name }}</mat-card-title> | ||
<mat-card-subtitle> | ||
<div>{{ complaint.reported_date }}</div> | ||
<div>{{ complaint.location_description }}</div> | ||
</mat-card-subtitle> | ||
</mat-card-header> | ||
<span class="complaint-divider"> | ||
<mat-divider></mat-divider> | ||
</span> | ||
<mat-card-content> | ||
<div> | ||
<div> | ||
<div class="complaint-card-content"><b>Complaint:</b></div> | ||
<pre><div class="complaint-description">{{ complaint.description }}</div></pre> | ||
</div> | ||
<div *ngIf="complaint.suggestions"> | ||
<div class="complaint-card-content"><b>Suggestions:</b></div> | ||
<div>{{ complaint.suggestions }}</div> | ||
</div> | ||
<div *ngIf="complaint.location_details"> | ||
<div class="complaint-card-content"><b>Location Details:</b></div> | ||
<div class="complaint-location-details">{{ complaint.location_details }}</div> | ||
</div> | ||
</div> | ||
</mat-card-content> | ||
<div class="complaint-divider"> | ||
<mat-divider></mat-divider> | ||
</div> | ||
<mat-card-footer> | ||
<div class="footer"> | ||
<div class="footer-button-container"> | ||
<div *ngIf="complaint.upvoted" class="complaint-upvote-active, footer-button-container"> | ||
<button (click)="[upVoteComplaint(complaint.upvoted, complaint.id), onClickEvent($event)]" | ||
class="complaint-upvote-active" mat-icon-button> | ||
<mat-icon>arrow_upward</mat-icon>{{ complaint.users_up_voted.length }} | ||
</button> | ||
</div> | ||
<div *ngIf="!complaint.upvoted" class="footer-button-container"> | ||
<button (click)="[upVoteComplaint(complaint.upvoted, complaint.id), onClickEvent($event)]" | ||
mat-icon-button> | ||
<mat-icon>arrow_upward</mat-icon>{{ complaint.users_up_voted.length }} | ||
</button> | ||
</div> | ||
</div> | ||
<button mat-icon-button class="footer-button-container"> | ||
<mat-icon>insert_comment</mat-icon>{{ complaint.comments.length }} | ||
</button> | ||
<div class="footer-button-container"> | ||
<div *ngIf="complaint.is_subscribed" class="footer-button-container"> | ||
<button (click)="[subscribeToComplaint(complaint.complaint_subscribed), onClickEvent($event)]" | ||
mat-icon-button> | ||
<mat-icon>notifications_active</mat-icon> | ||
</button> | ||
</div> | ||
<div *ngIf="!complaint.is_subscribed" class="footer-button-container"> | ||
<button (click)="[subscribeToComplaint(complaint.complaint_subscribed), onClickEvent($event)]" | ||
mat-icon-button> | ||
<mat-icon>notifications</mat-icon> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</mat-card-footer> | ||
</mat-card> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
import { IComplaint } from '../../interfaces'; | ||
import { DataService } from '../../data.service'; | ||
import { API } from '../../../api'; | ||
import { VenterDataService } from '../venter-data.service'; | ||
|
||
@Component({ | ||
selector: 'app-complaint-card', | ||
templateUrl: './complaint-card.component.html', | ||
styleUrls: ['./complaint-card.component.css'] | ||
}) | ||
export class ComplaintCardComponent implements OnInit { | ||
|
||
@Input() complaintList: IComplaint[]; | ||
@Input() myComplaintsList: IComplaint[]; | ||
constructor( | ||
public dataService: DataService, | ||
public venterDataService: VenterDataService, | ||
) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
refresh() { | ||
/* Get all the complaints from server*/ | ||
this.dataService.FireGET<IComplaint[]>(API.Complaints).subscribe(result => { | ||
this.complaintList = result; | ||
this.venterDataService.getComplaintInfo(this.complaintList); | ||
}); | ||
/* Get the current user complaints from server*/ | ||
this.dataService.FireGET<IComplaint[]>(API.MyComplaints).subscribe(result => { | ||
this.myComplaintsList = result; | ||
this.venterDataService.getComplaintInfo(this.myComplaintsList); | ||
}); | ||
} | ||
|
||
onClickEvent(event) { | ||
event.stopPropagation(); | ||
} | ||
|
||
subscribeToComplaint(complaint_subscribed: number, complaintId: string) { | ||
this.venterDataService.subscribeToComplaint(complaint_subscribed, complaintId); | ||
this.refresh(); | ||
} | ||
|
||
upVoteComplaint(has_upvoted: boolean, complaintId: string) { | ||
this.venterDataService.upVoteComplaint(has_upvoted, complaintId); | ||
this.refresh(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue found: Strings must use doublequote.