mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Account for "read only" property
This commit is contained in:
		@@ -172,7 +172,8 @@ export function ApiForm(props: ApiFormProps) {
 | 
				
			|||||||
        required: field.required,
 | 
					        required: field.required,
 | 
				
			||||||
        placeholder: field.placeholder,
 | 
					        placeholder: field.placeholder,
 | 
				
			||||||
        api_url: field.api_url,
 | 
					        api_url: field.api_url,
 | 
				
			||||||
        model: field.model
 | 
					        model: field.model,
 | 
				
			||||||
 | 
					        read_only: field.read_only
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -184,6 +185,10 @@ export function ApiForm(props: ApiFormProps) {
 | 
				
			|||||||
      size="xl"
 | 
					      size="xl"
 | 
				
			||||||
      radius="sm"
 | 
					      radius="sm"
 | 
				
			||||||
      opened={props.opened}
 | 
					      opened={props.opened}
 | 
				
			||||||
 | 
					      overlayProps={{
 | 
				
			||||||
 | 
					        blur: 1,
 | 
				
			||||||
 | 
					        opacity: 0.5
 | 
				
			||||||
 | 
					      }}
 | 
				
			||||||
      onClose={() => {
 | 
					      onClose={() => {
 | 
				
			||||||
        props.onClose ? props.onClose() : null;
 | 
					        props.onClose ? props.onClose() : null;
 | 
				
			||||||
      }}
 | 
					      }}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ export type ApiFormFieldType = {
 | 
				
			|||||||
  icon?: ReactNode;
 | 
					  icon?: ReactNode;
 | 
				
			||||||
  fieldType?: string;
 | 
					  fieldType?: string;
 | 
				
			||||||
  api_url?: string;
 | 
					  api_url?: string;
 | 
				
			||||||
 | 
					  read_only?: boolean;
 | 
				
			||||||
  model?: string;
 | 
					  model?: string;
 | 
				
			||||||
  required?: boolean;
 | 
					  required?: boolean;
 | 
				
			||||||
  hidden?: boolean;
 | 
					  hidden?: boolean;
 | 
				
			||||||
@@ -58,6 +59,8 @@ function constructField({
 | 
				
			|||||||
    def.error = null;
 | 
					    def.error = null;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def.disabled = def.disabled || def.read_only;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Retrieve the latest value from the form
 | 
					  // Retrieve the latest value from the form
 | 
				
			||||||
  let value = form.values[def.name];
 | 
					  let value = form.values[def.name];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,6 +84,9 @@ export default function Home() {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name: 'target_date'
 | 
					      name: 'target_date'
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      name: 'status'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -96,6 +99,9 @@ export default function Home() {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      name: 'description'
 | 
					      name: 'description'
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      name: 'status'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user