Skip to content

Commit

Permalink
Merge pull request #4 from nadeocfg/fix/edit-orders
Browse files Browse the repository at this point in the history
fix: fixed serviceMan permissions in orderEdit
  • Loading branch information
nadeocfg authored May 20, 2024
2 parents 53df5d6 + f431f65 commit e2f00d4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frontend/src/pages/orders/OrderEdit/OrderEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ import { getTotalSum } from '../../../utils/getOrderSum';
import ReactInputMask from 'react-input-mask';

const OrderEdit = () => {
const userRoleCode = useSelector(
(store: StoreModel) => store.userStore.authResponse.roleCode
);
const [fetchFunction, setFetchFunction] = React.useState<any>(() => () => {});
const [modalProps, setModalProps] = useState({
title: '',
Expand Down Expand Up @@ -326,6 +329,9 @@ const OrderEdit = () => {
}
value={orderData.customer?.fullName || ''}
required
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>

<TextField
Expand All @@ -352,12 +358,18 @@ const OrderEdit = () => {
value={orderData.address}
onChange={handleChange('address')}
required
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>

<ReactInputMask
mask="+7 (999) 999-99-99"
onChange={handleChange('phone')}
value={orderData.phone}
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
>
<TextField
className="input form__field"
Expand All @@ -379,6 +391,9 @@ const OrderEdit = () => {
}
value={orderData.customer?.boiler?.name || ''}
required
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>

<TextField
Expand All @@ -388,6 +403,9 @@ const OrderEdit = () => {
value={orderData.visitPrice}
type="number"
onChange={handleChange('visitPrice')}
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>

<TextField
Expand All @@ -396,6 +414,9 @@ const OrderEdit = () => {
variant="outlined"
value={orderData.comment}
onChange={handleChange('comment')}
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>
</CardContent>
</Card>
Expand All @@ -416,6 +437,9 @@ const OrderEdit = () => {
}
value={orderData.serviceMan?.fullName || ''}
required
disabled={
userRoleCode !== 'SUPER_ADMIN' && userRoleCode !== 'ADMIN'
}
/>
</CardContent>
</Card>
Expand Down

0 comments on commit e2f00d4

Please sign in to comment.