Disabled the editing of the country manager of a corporate from the payment record
This commit is contained in:
@@ -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
Reference in New Issue
Block a user