Disabled the editing of the country manager of a corporate from the payment record

This commit is contained in:
Tiago Ribeiro
2024-04-21 12:22:02 +01:00
parent 1a17689cd2
commit f76b7578a6
2 changed files with 1375 additions and 1124 deletions

View File

@@ -40,6 +40,9 @@ interface Props {
onViewTeachers?: () => void; onViewTeachers?: () => void;
onViewCorporate?: () => void; onViewCorporate?: () => void;
disabled?: boolean; disabled?: boolean;
disabledFields?: {
countryManager?: boolean;
};
} }
const USER_STATUS_OPTIONS = [ const USER_STATUS_OPTIONS = [
@@ -75,6 +78,7 @@ const UserCard = ({
onViewTeachers, onViewTeachers,
onViewCorporate, onViewCorporate,
disabled = false, disabled = false,
disabledFields = {},
}: Props) => { }: Props) => {
const [expiryDate, setExpiryDate] = useState<Date | null | undefined>( const [expiryDate, setExpiryDate] = useState<Date | null | undefined>(
user.subscriptionExpirationDate, user.subscriptionExpirationDate,
@@ -359,7 +363,8 @@ const UserCard = ({
<Select <Select
className={clsx( className={clsx(
"px-4 py-4 w-full text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full border border-mti-gray-platinum focus:outline-none", "px-4 py-4 w-full text-sm font-normal placeholder:text-mti-gray-cool bg-white rounded-full border border-mti-gray-platinum focus:outline-none",
!["developer", "admin"].includes(loggedInUser.type) && (!["developer", "admin"].includes(loggedInUser.type) ||
disabledFields.countryManager) &&
"!bg-mti-gray-platinum/40 !text-mti-gray-dim cursor-not-allowed", "!bg-mti-gray-platinum/40 !text-mti-gray-dim cursor-not-allowed",
)} )}
options={[ options={[
@@ -400,7 +405,8 @@ const UserCard = ({
}} }}
// editing country manager should only be available for dev/admin // editing country manager should only be available for dev/admin
isDisabled={ isDisabled={
!["developer", "admin"].includes(loggedInUser.type) !["developer", "admin"].includes(loggedInUser.type) ||
disabledFields.countryManager
} }
/> />
)} )}

File diff suppressed because it is too large Load Diff