From fa3929d5e9164fb6fe1925ca36dfd31d840e9ff4 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Tue, 27 Aug 2024 16:35:34 +0100 Subject: [PATCH] Allow Master Corporate to pay for their subscription --- src/pages/(status)/PaymentDue.tsx | 111 +++++++++++++++------------- src/utils/propagate.user.changes.ts | 2 +- 2 files changed, 60 insertions(+), 53 deletions(-) diff --git a/src/pages/(status)/PaymentDue.tsx b/src/pages/(status)/PaymentDue.tsx index b081db1d..c8d90612 100644 --- a/src/pages/(status)/PaymentDue.tsx +++ b/src/pages/(status)/PaymentDue.tsx @@ -160,49 +160,54 @@ export default function PaymentDue({user, hasExpired = false, reload}: Props) { )} - {!isIndividual() && user.type === "corporate" && user?.corporateInformation.payment && ( -
- - To add to your use of EnCoach and that of your students and teachers, please pay your designated package below: - -
-
- EnCoach's Logo - EnCoach - {user.corporateInformation?.monthlyDuration} Months -
-
- - {user.corporateInformation.payment.value} {user.corporateInformation.payment.currency} - - { - setIsLoading(false); - setTimeout(reload, 500); - }} - /> -
-
- This includes: -
    -
  • - - Allow a total of {user.corporateInformation.companyInformation.userAmount} students and teachers to - use EnCoach -
  • -
  • - Train their abilities for the IELTS exam
  • -
  • - Gain insights into your students' weaknesses and strengths
  • -
  • - Allow them to correctly prepare for the exam
  • -
+ {!isIndividual() && + (user?.type === "corporate" || user?.type === "mastercorporate") && + user?.corporateInformation.payment && ( +
+ + To add to your use of EnCoach and that of your students and teachers, please pay your designated package + below: + +
+
+ EnCoach's Logo + + EnCoach - {user.corporateInformation?.monthlyDuration} Months + +
+
+ + {user.corporateInformation.payment.value} {user.corporateInformation.payment.currency} + + { + setIsLoading(false); + setTimeout(reload, 500); + }} + /> +
+
+ This includes: +
    +
  • + - Allow a total of {user.corporateInformation.companyInformation.userAmount} students and teachers + to use EnCoach +
  • +
  • - Train their abilities for the IELTS exam
  • +
  • - Gain insights into your students' weaknesses and strengths
  • +
  • - Allow them to correctly prepare for the exam
  • +
+
-
- )} - {!isIndividual() && user.type !== "corporate" && ( + )} + {!isIndividual() && !(user?.type === "corporate" || user?.type === "mastercorporate") && (
You are not the person in charge of your time credits, please contact your administrator about this situation. @@ -213,17 +218,19 @@ export default function PaymentDue({user, hasExpired = false, reload}: Props) {
)} - {!isIndividual() && user.type === "corporate" && !user.corporateInformation.payment && ( -
- - An admin nor your agent have yet set the price intended to your requirements in terms of the amount of users you - desire and your expected monthly duration. - - - Please try again later or contact your agent or an admin, thank you for your patience. - -
- )} + {!isIndividual() && + (user?.type === "corporate" || user?.type === "mastercorporate") && + !user.corporateInformation.payment && ( +
+ + An admin nor your agent have yet set the price intended to your requirements in terms of the amount of users + you desire and your expected monthly duration. + + + Please try again later or contact your agent or an admin, thank you for your patience. + +
+ )}
) : ( diff --git a/src/utils/propagate.user.changes.ts b/src/utils/propagate.user.changes.ts index c0346741..1ec882fe 100644 --- a/src/utils/propagate.user.changes.ts +++ b/src/utils/propagate.user.changes.ts @@ -13,7 +13,7 @@ export const propagateStatusChange = (userId: string, status: UserStatus) => const user = docUser.data() as User; // only update the status of the user's groups if the user is a corporate user - if (user.type === "corporate") { + if (user.type === "corporate" || user.type === "mastercorporate") { getDocs(query(collection(db, "groups"), where("admin", "==", userId))).then(async (userGroupsRef) => { const userGroups = userGroupsRef.docs.map((x) => x.data());