Skip to content

Commit

Permalink
fix: junior hide cart & user management issues & pagination issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 committed May 10, 2023
1 parent 66f29cf commit 5a03f05
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions apps/storefront/src/components/form/B3ControlSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default function B3ControlSelect({
onChange,
replaceOptions,
size = 'small',
disabled = false,
} = rest

const b3Lang = useB3Lang()
Expand Down Expand Up @@ -71,6 +72,7 @@ export default function B3ControlSelect({
? 'rgba(0, 0, 0, 0.38)'
: 'rgba(0, 0, 0, 0.6)',
}}
disabled={disabled}
>
{label && (
<InputLabel
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/src/components/table/B3PaginationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function PaginationTable(
}

const refresh = () => {
fetchList(initPagination, true)
fetchList(pagination, true)
}

useEffect(() => {
Expand Down
10 changes: 8 additions & 2 deletions apps/storefront/src/hooks/dom/useMyQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { cloneDeep } from 'lodash'

import { getContrastColor } from '@/components/outSideComponents/utils/b3CustomStyles'
import { CustomStyleContext } from '@/shared/customStyleButtton'
import { B3LStorage } from '@/utils'
import { B3LStorage, removeCartPermissions } from '@/utils'

// import { removeCartPermissions } from '@/utils/b3RolePermissions'
import useDomVariation from './useDomVariation'
Expand Down Expand Up @@ -61,7 +61,13 @@ const useMyQuote = ({
}
}, [])

const [openQuickView] = useDomVariation(globalB3['dom.setToQuote'])
const cd = () => {
if (+role === 2) {
removeCartPermissions(role)
}
}

const [openQuickView] = useDomVariation(globalB3['dom.setToQuote'], cd)

const {
color = '',
Expand Down
6 changes: 4 additions & 2 deletions apps/storefront/src/pages/usermanagement/AddEditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useB3Lang } from '@b3/lang'
import { B3CustomForm, B3Dialog } from '@/components'
import { GlobaledContext } from '@/shared/global'
import { addOrUpdateUsers, checkUserEmail } from '@/shared/service/b2b'
import { snackbar } from '@/utils'
import { B3SStorage, snackbar } from '@/utils'

import {
emailError,
Expand Down Expand Up @@ -151,7 +151,9 @@ function AddEditUser(
}

const handleOpenAddEditUserClick = (type: string, data: UsersList) => {
const usersFiles = getUsersFiles(type)
const currentUserId = B3SStorage.get('B3UserId')
const disabledUserRole = +data.id === +currentUserId
const usersFiles = getUsersFiles(type, disabledUserRole)
setUsersFiles(usersFiles)
setEditData(data)
setType(type)
Expand Down
4 changes: 3 additions & 1 deletion apps/storefront/src/pages/usermanagement/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const getFilterMoreList = () => {
fieldType: 'dropdown',
options: getUserRole(),
xs: 12,
disabled: false,
variant: 'filled',
size: 'small',
},
Expand All @@ -69,9 +70,10 @@ const getFilterMoreList = () => {
return filterMoreList
}

const getUsersFiles = (type: string) => {
const getUsersFiles = (type: string, disabledUserRole = false) => {
const roleArr = [...getFilterMoreList()]
roleArr[0].required = true
roleArr[0].disabled = disabledUserRole
const usersFiles = [
...roleArr,
{
Expand Down
2 changes: 2 additions & 0 deletions apps/storefront/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import distanceDay from './b3Picker'
import getProductPriceIncTax from './b3Price'
import b2bPrintInvoice from './b3PrintInvoice'
import getProxyInfo from './b3Proxy'
import { removeCartPermissions } from './b3RolePermissions'
import { B3LStorage, B3SStorage } from './b3Storage'
import { globalSnackbar, snackbar } from './b3Tip'
import getCookie from './b3utils'
Expand Down Expand Up @@ -76,6 +77,7 @@ export {
isModifierNumberTextValid,
isModifierTextValid,
loginInfo,
removeCartPermissions,
serialize,
showPageMask,
snackbar,
Expand Down

0 comments on commit 5a03f05

Please sign in to comment.