Skip to content
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

Thang/Add Paypal email, Add revenue dashboard #131

Merged
merged 7 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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