Skip to content

Commit

Permalink
removed nested forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ridz1208 committed Dec 17, 2024
1 parent 1fa1b9f commit 257f039
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 211 deletions.
77 changes: 37 additions & 40 deletions modules/biobank/jsx/batchEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Modal from 'Modal';
import Loader from 'Loader';
import {mapFormOptions, clone, isEmpty} from './helpers.js';
import {
FormElement,
TextboxElement,
SelectElement,
StaticElement,
Expand Down Expand Up @@ -497,49 +496,47 @@ class BatchEditForm extends React.PureComponent {
onSubmit={Object.keys(list).length > 1 && handleSubmit}
throwWarning={true}
>
<FormElement>
<div className='row'>
<div className='col-sm-10 col-sm-offset-1'>
<StaticElement
label='Editing Note'
text="Select or Scan the specimens to be edited. Specimens
must share the same Type."
/>
<StaticElement
label='Specimen Type'
text={(options.specimen.types[current.typeId]||{}).label || '—'}
/>
<div className='row'>
<div className='col-xs-6'>
<h4>Barcode Input</h4>
<div className='form-top'/>
<BarcodeInput
data={data}
options={options}
list={list}
validateListItem={this.validateListItem}
addListItem={this.addListItem}
/>
<SearchableDropdown
name={'poolId'}
label={'Pool'}
onUserInput={handlePoolInput}
options={pools}
value={poolId}
/>
</div>
<div className='col-xs-6'>
<h4>Barcode List</h4>
<div className='form-top'/>
<div className='preparation-list'>
{barcodeList}
</div>
<div className='row'>
<div className='col-sm-10 col-sm-offset-1'>
<StaticElement
label='Editing Note'
text="Select or Scan the specimens to be edited. Specimens
must share the same Type."
/>
<StaticElement
label='Specimen Type'
text={(options.specimen.types[current.typeId]||{}).label || '—'}
/>
<div className='row'>
<div className='col-xs-6'>
<h4>Barcode Input</h4>
<div className='form-top'/>
<BarcodeInput
data={data}
options={options}
list={list}
validateListItem={this.validateListItem}
addListItem={this.addListItem}
/>
<SearchableDropdown
name={'poolId'}
label={'Pool'}
onUserInput={handlePoolInput}
options={pools}
value={poolId}
/>
</div>
<div className='col-xs-6'>
<h4>Barcode List</h4>
<div className='form-top'/>
<div className='preparation-list'>
{barcodeList}
</div>
</div>
{editForms}
</div>
{editForms}
</div>
</FormElement>
</div>
</Modal>
);
}
Expand Down
83 changes: 40 additions & 43 deletions modules/biobank/jsx/batchProcessForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Modal from 'Modal';
import Loader from 'Loader';
import {mapFormOptions, clone, isEmpty} from './helpers.js';
import {
FormElement,
StaticElement,
SearchableDropdown,
} from 'jsx/Form';
Expand Down Expand Up @@ -245,52 +244,50 @@ class BatchProcessForm extends React.PureComponent {

const handlePoolInput = (name, value) => value && this.setPool(name, value);
const form = (
<FormElement>
<div className='row'>
<div className='col-sm-10 col-sm-offset-1'>
<StaticElement
label='Processing Note'
text="Select or Scan the specimens to be prepared. Specimens must
have a Status of 'Available', and share the same Type.
Any previous value associated with a Specimen will be
overwritten if one is added on this form."
/>
<StaticElement
label='Specimen Type'
text={(options.specimen.types[current.typeId]||{}).label || '—'}
/>
<div className='row'>
<div className='col-xs-6'>
<h4>Barcode Input</h4>
<div className='form-top'/>
<BarcodeInput
data={data}
options={options}
list={list}
containerId={containerId}
validateListItem={this.validateListItem}
addListItem={this.addListItem}
/>
<SearchableDropdown
name={'poolId'}
label={'Pool'}
onUserInput={handlePoolInput}
options={pools}
value={poolId}
/>
</div>
<div className='col-xs-6'>
<h4>Barcode List</h4>
<div className='form-top'/>
<div className='preparation-list'>
{barcodeList}
</div>
<div className='row'>
<div className='col-sm-10 col-sm-offset-1'>
<StaticElement
label='Processing Note'
text="Select or Scan the specimens to be prepared. Specimens must
have a Status of 'Available', and share the same Type.
Any previous value associated with a Specimen will be
overwritten if one is added on this form."
/>
<StaticElement
label='Specimen Type'
text={(options.specimen.types[current.typeId]||{}).label || '—'}
/>
<div className='row'>
<div className='col-xs-6'>
<h4>Barcode Input</h4>
<div className='form-top'/>
<BarcodeInput
data={data}
options={options}
list={list}
containerId={containerId}
validateListItem={this.validateListItem}
addListItem={this.addListItem}
/>
<SearchableDropdown
name={'poolId'}
label={'Pool'}
onUserInput={handlePoolInput}
options={pools}
value={poolId}
/>
</div>
<div className='col-xs-6'>
<h4>Barcode List</h4>
<div className='form-top'/>
<div className='preparation-list'>
{barcodeList}
</div>
</div>
{editForms}
</div>
{editForms}
</div>
</FormElement>
</div>
);

const handleClose = () => this.setState(initialState, this.props.onClose);
Expand Down
43 changes: 20 additions & 23 deletions modules/biobank/jsx/containerForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';
import Modal from 'Modal';
import {ListForm, ListItem} from './listForm.js';
import {
FormElement,
SelectElement,
TextboxElement,
DateElement,
Expand Down Expand Up @@ -84,29 +83,27 @@ class ContainerForm extends Component {
onSubmit={this.handleSubmit}
throwWarning={true}
>
<FormElement>
<div className="row">
<div className="col-xs-11">
<SelectElement
name="centerId"
label="Site"
options={options.centers}
onUserInput={this.setCurrent}
required={true}
value={current.centerId}
errorMessage={(errors.container||{}).centerId}
/>
</div>
<div className="row">
<div className="col-xs-11">
<SelectElement
name="centerId"
label="Site"
options={options.centers}
onUserInput={this.setCurrent}
required={true}
value={current.centerId}
errorMessage={(errors.container||{}).centerId}
/>
</div>
<ListForm
list={list}
errors={errors.list}
setList={this.setList}
listItem={{}}
>
<ContainerSubForm options={options}/>
</ListForm>
</FormElement>
</div>
<ListForm
list={list}
errors={errors.list}
setList={this.setList}
listItem={{}}
>
<ContainerSubForm options={options}/>
</ListForm>
</Modal>
);
}
Expand Down
Loading

0 comments on commit 257f039

Please sign in to comment.