File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818 SelectTrigger ,
1919 SelectValue ,
2020} from '@/components/ui/select' ;
21+ import { useUserRole } from '@/core/utils/hooks' ;
2122import {
2223 MovieEditFormSchema ,
2324 movieEditFormSchema ,
@@ -43,6 +44,8 @@ export function FormMovieEdit({
4344} : Readonly < {
4445 movie : MovieDto ;
4546} > ) {
47+ const userRole = useUserRole ( ) ;
48+
4649 const [ studioSearchValue , setStudioSearchValue ] = useState (
4750 movie ?. studio ?. display_name ,
4851 ) ;
@@ -141,7 +144,12 @@ export function FormMovieEdit({
141144 < FormItem >
142145 < FormLabel > DVD ID</ FormLabel >
143146 < FormControl >
144- < Input disabled placeholder = "DVD ID" readOnly { ...field } />
147+ < Input
148+ disabled = { ! [ 'admin' , 'moderator' ] . includes ( userRole ?? '' ) }
149+ placeholder = "DVD ID"
150+ readOnly = { ! [ 'admin' , 'moderator' ] . includes ( userRole ?? '' ) }
151+ { ...field }
152+ />
145153 </ FormControl >
146154 < FormMessage />
147155 </ FormItem >
You can’t perform that action at this time.
0 commit comments