Allow enable/disable on create. Enabled=>Status header
[osm/UI.git] / skyquake / framework / widgets / form_controls / input.jsx
index 370afcc..9b5e685 100644 (file)
@@ -17,7 +17,7 @@
  */
 import './formControls.scss';
 import SelectOption from 'widgets/form_controls/selectOption.jsx';
-
+import CircleSVG from '../../../node_modules/open-iconic/svg/media-record.svg'
 import React, {Component} from 'react';
 
 export default class Input extends Component {
@@ -71,6 +71,14 @@ export default class Input extends Component {
         } else {
             displayedValue = value.toString();
         }
+        if( props.readonly && props.type == "checkbox" && props.checked ) {
+            displayedValue = <img src={CircleSVG} />
+        }
+
+        if( props.readonly && props.type == "radiogroup" && props.readonlydisplay ) {
+            displayedValue = props.readonlydisplay
+        }
+
         let html = (
             <label className={className} style={props.style}>
               <span> { label } {isRequired}</span>
@@ -94,10 +102,12 @@ function buildRadioButtons(props) {
        <div className={className}>
             {
                 props.options.map((o,i) => {
+                    let label = o.label || o;
+                    let value = o.value || o;
                     return (
                         <label key={i}>
-                            {o.label}
-                            <input type="radio" checked={props.value == o.value} value={o.value} onChange={props.onChange} />
+                            {label}
+                            <input type="radio" checked={props.value == value} value={value} onChange={props.onChange} />
                         </label>
                     )
                 })