Skip to content

Commit

Permalink
Merge pull request #46 from DevCom-IITB/bug-fix
Browse files Browse the repository at this point in the history
Resolved Issue #25, #26, #23
  • Loading branch information
kumar-09 authored Oct 23, 2024
2 parents 65a0f2c + e0be9bc commit 30a45bb
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<img class="mess-i-logo" src="assets/mess-i-logo.png"> <!-- isme issues hai -->
<a id="nav_home" class="nav-link nav-items-style" *ngIf="auth.isStaff()" routerLink="/home" >HOME</a>
<a id="nav_student_list" class="nav-link nav-items-style" *ngIf="auth.isStaff()" routerLink="/list">STUDENTS' LIST</a>
<a id="nav_rebate" class="nav-link nav-items-style" *ngIf="auth.isStudent()" routerLink="/rebate" >REBATES</a>
<a id="nav_rebate" class="nav-link nav-items-style" role="button" *ngIf="auth.isStudent()" routerLink="/rebate">REBATES</a>
<a id="nav_rebate_admin" class="nav-link nav-items-style" *ngIf="auth.isRebate()" routerLink="/rebate-admin" >REBATES ADMIN</a>
<a id="nav_guest_admin" class="nav-link nav-items-style" *ngIf="auth.isStaff()" routerLink="/guest-admin">GUEST ADMIN</a>
<a id="nav_overview" class="nav-link nav-items-style" *ngIf="auth.isStaff()" routerLink="/overview" >MESS STATS</a>
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,6 @@ export class AppComponent {
this.router.navigate([place])
}

}
}


2 changes: 2 additions & 0 deletions src/app/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class AuthService {
getRoll(){
return this.roll_no;
}


forgetPassword(username:any) {
let url = this.baseurl.concat("/api/change_password");
Expand All @@ -173,4 +174,5 @@ export class AuthService {
})
);
}

}
5 changes: 5 additions & 0 deletions src/app/home/devices/devices.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.device-data{
display: flex;
flex-direction: column;

}
.device-info{
display: flex;
Expand All @@ -20,4 +21,8 @@ img{
}
p{
padding-right:15px;
}

h3{
font-weight: bold;
}
3 changes: 2 additions & 1 deletion src/app/home/devices/devices.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Component, Input, OnInit } from '@angular/core';
})
export class DevicesComponent implements OnInit {

@Input() device:any;
@Input() device : any ;

constructor() { }

ngOnInit(): void {
Expand Down
26 changes: 25 additions & 1 deletion src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ export class HomeComponent implements OnInit {

public pending_rebates: RebateRequest[] = new Array();
devices:any;
// devices = [
// {
// hostel: 'Hostel A',
// id: 123,
// sync: '2024-08-15 10:00 AM',
// version: '1.0.3',
// cards: ['Card1', 'Card2', 'Card3']
// },
// {
// hostel: 'Hostel B',
// id: 456,
// sync: '2024-08-15 10:05 AM',
// version: '1.0.4',
// cards: ['Card4', 'Card5', 'Card6']
// },
// {
// hostel: 'Hostel C',
// id: 789,
// sync: '2024-08-15 10:10 AM',
// version: '1.0.5',
// cards: ['Card7', 'Card8', 'Card9']
// }
// ];
date:string;

constructor(private data_service:StudentdataService, public auth_service: AuthService, private router: Router) {
Expand All @@ -33,7 +56,8 @@ export class HomeComponent implements OnInit {
//FIXME: Remove the console log, maybe log somewhere else
console.log(e);
});



this.data_service.getDevices().then((res)=>{
this.devices = res;
}).catch((e)=>{
Expand Down
4 changes: 4 additions & 0 deletions src/app/rebate/rebate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class RebateComponent implements OnInit {
this.router.navigate(['login'])
}
// console.log(this.rejected_rebates)
if(!this.auth.isStudent() ){
this.router.navigate(['landing'])
}

}


Expand Down
9 changes: 6 additions & 3 deletions src/app/rebate/stu-reb-card/stu-reb-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@
<button
class="btn btn-light rebate-action-btn"
(click)="updateRebateData(p_rebate_reason, p_rebate_start, p_rebate_end)"
*ngIf="auth.isStudent()"

*ngIf="isStudentPage()"
>
Make Amendments
</button>
<button
class="btn btn-light rebate-action-btn"
(click)="deleteRebate()"
*ngIf="auth.isStudent()"

*ngIf="isStudentPage()"
>
Cancel your rebate
</button>
Expand All @@ -82,7 +84,8 @@
<button
class="btn btn-light rebate-action-btn"
(click)="updateAcceptedRebate(p_rebate_start, p_rebate_end)"
*ngIf="auth.isStudent()"

*ngIf="isStudentPage()"
>
Shrink Duration
</button>
Expand Down
8 changes: 8 additions & 0 deletions src/app/rebate/stu-reb-card/stu-reb-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class StuRebCardComponent implements OnInit {
public p_rebate_comment: string;
private numToMonth: string[] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
// @Input() public isApproved: boolean = false;
public on_admin_page:boolean ;
private adminRoutes: string[] = ["/rebate-admin","/studentcard"];
@Input() public approval_state: string = "pending";
@Output() public updateList = new EventEmitter();

Expand All @@ -41,6 +43,8 @@ export class StuRebCardComponent implements OnInit {
this.p_rebate_reason = "";
this.p_rebate_reason = this.rebate_request.reason;
this.p_rebate_comment = this.rebate_request?.comment ?? "";
this.on_admin_page = this.adminRoutes.some(sub => this.router.url.startsWith(sub));

// console.log(this.rebate_request)
}

Expand Down Expand Up @@ -115,5 +119,9 @@ export class StuRebCardComponent implements OnInit {
console.log(e);
})
}
isStudentPage() {
return this.auth.isStudent() && !this.on_admin_page;
}

}

0 comments on commit 30a45bb

Please sign in to comment.