- Je suis un notaire
+ Je suis un notaire / collaborateur
diff --git a/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx b/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx
index 4c9bea8d..17a66917 100644
--- a/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx
+++ b/src/front/Components/Layouts/Subscription/Manage/SubscriptionManageCollaborators/index.tsx
@@ -6,7 +6,7 @@ import CheckBox from "@Front/Components/DesignSystem/CheckBox";
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
import React, { useCallback, useEffect, useState } from "react";
import User, { Subscription } from "le-coffre-resources/dist/Admin";
-import JwtService from "@Front/Services/JwtService/JwtService";
+import JwtService, { IUserJwtPayload } from "@Front/Services/JwtService/JwtService";
import Subscriptions from "@Front/Api/LeCoffreApi/Admin/Subscriptions/Subscriptions";
import Users from "@Front/Api/LeCoffreApi/Admin/Users/Users";
import { useRouter } from "next/router";
@@ -17,9 +17,10 @@ export default function SubscriptionManageCollaborators() {
const [subscription, setSubscription] = useState
(null);
const [availableCollaborators, _setAvailableCollaborators] = useState([]);
const [selectedCollaborators, setSelectedCollaborators] = useState([]);
-
+ const [jwt, setJwt] = useState(undefined);
const loadSubscription = useCallback(async () => {
const jwt = JwtService.getInstance().decodeJwt();
+ setJwt(jwt);
const subscription = await Subscriptions.getInstance().get({
where: { office: { uid: jwt?.office_Id } },
include: { seats: { include: { user: true } } },
@@ -80,7 +81,7 @@ export default function SubscriptionManageCollaborators() {
return (
- {subscription && (
+ {subscription && jwt && (
Choisissez les collaborateurs pour votre abonnement
@@ -100,8 +101,9 @@ export default function SubscriptionManageCollaborators() {
checked={selectedCollaborators.includes(collaborator.uid!)}
onChange={handleChange}
disabled={
- selectedCollaborators.length >= subscription.nb_seats! &&
- !selectedCollaborators.includes(collaborator.uid!)
+ (selectedCollaborators.length >= subscription.nb_seats! &&
+ !selectedCollaborators.includes(collaborator.uid!)) ||
+ jwt.userId === collaborator.uid
}
name="collaborators"
/>