Skip to content

Commit

Permalink
Merge pull request #131 from AnataAria/Thang
Browse files Browse the repository at this point in the history
Thang/Add Paypal email, Add revenue dashboard
  • Loading branch information
AnataAria authored Nov 16, 2023
2 parents e003923 + f7e1412 commit 3a7762c
Show file tree
Hide file tree
Showing 7 changed files with 352 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public ResponseEntity<InstructorDto> getInstructorInfo(
return ResponseEntity.ok(instructorService.findInstructorDtoByInstructorEmail(email));
}

@PostMapping("/instructor/paypal")
public ResponseEntity<InstructorDto> addPayPalEmail(@RequestHeader(value = "Authorization") String instructorToken,
@RequestParam(value = "paypalEmail") String paypalEmail){
@GetMapping("/instructor/paypal")
public ResponseEntity<InstructorDto> addPayPalEmail(@RequestHeader(value = "Authorization", defaultValue = "") String instructorToken,
@RequestParam String paypalEmail){
String email = jwtService.extractUserEmail(instructorToken.substring(7));
return ResponseEntity.ok(instructorService.addInstructorPayPalEmail(email,paypalEmail));
}
Expand Down
16 changes: 16 additions & 0 deletions frontend/my-app/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import { type } from "os";
export type MonthlyData = {
year?: number | null;
firstMonth: number;
secondMonth: number;
thirdMonth: number;
fourthMonth: number;
fifthMonth: number;
sixthMonth: number;
seventhMonth: number;
eighthMonth: number;
ninthMonth: number;
tenthMonth: number;
eleventhMonth: number;
twelfthMonth: number;
}
export type InstructorInfo = {
id: number;
fullName: string;
specialization:string;
phone:number;
avatar:string;
paypalEmail:string;
};
export type InstructorSalary = {
instructorInfo: InstructorInfo;
Expand Down
8 changes: 6 additions & 2 deletions frontend/my-app/src/routes/CourseCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let isFetchManual: boolean;
import { Card, Rating, Badge } from "flowbite-svelte";
let open = true;
let tmpRating: number;
let counter = 6;
let message = "";
let errorMsg = "";
Expand Down Expand Up @@ -91,7 +92,10 @@
await axios
.get(apiBaseUrl + `review/rating?courseID=${id}`)
.then((response) => {
if (response.status === 200) rating = response.data;
if (response.status === 200){
tmpRating = response.data;
rating = parseFloat(tmpRating.toFixed(1));
}
});
}
let status = false;
Expand Down Expand Up @@ -146,7 +150,7 @@
</h5>
</a>
<Rating {rating} class="mt-2.5 mb-5">
<Badge slot="text" class="ml-3">{rating.toFixed(1)}</Badge>
<Badge slot="text" class="ml-3">{rating}</Badge>
</Rating>
<div class="flex justify-between items-center">
<span class="text-3xl font-bold text-gray-900 dark:text-white"
Expand Down
6 changes: 4 additions & 2 deletions frontend/my-app/src/routes/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@
<NavHamburger />
</div>
<NavUl>
{#if jwtData.role == "CUSTOMER"}
{#if jwtData.role === "CUSTOMER"}
<NavLi href="/mylearning">My Learning</NavLi>
<NavLi href="/cart">Your Cart</NavLi>
{:else if jwtData.role === "STAFF"}
<NavLi href="/staff/revenuestatistics">Staff Management Dashboard</NavLi>
{:else}
<NavLi href="/teaching">Assign Instructor</NavLi>
{/if}
Expand All @@ -136,7 +138,7 @@
<Avatar id="user-drop" src="" class="cursor-pointer" />
<Dropdown triggeredBy="#user-drop">
<DropdownHeader>
<span class="block text-sm">User</span>
<span class="block text-sm">{jwtData.role}</span>
<span class="block truncate text-sm font-medium">{jwtData.email}</span
>
</DropdownHeader>
Expand Down
Loading

0 comments on commit 3a7762c

Please sign in to comment.