%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
<%namespace file="/requests/common/sample_state.mako" import="render_sample_state" />
<%namespace file="/requests/common/sample_datasets.mako" import="render_sample_datasets" />
<%def name="stylesheets()">
${parent.stylesheets()}
${h.css( "library" )}
%def>
<%def name="javascripts()">
${parent.javascripts()}
%def>
<% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() %>
%if request.samples_without_library_destinations:
${render_msg( "Select a target data library and folder for all the samples before starting the sequence run", "warning" )}
%endif
%if request.is_rejected:
${render_msg( "Reason for rejection: " + request.last_comment, "warning" )}
%endif
%if message:
${render_msg( message, status )}
%endif
%if managing_samples or len( current_samples ) > len( request.samples ):
${grid_name}
%else:
${grid_name}
%endif
Name
%for index, field in fields_dict.items():
${field['label']}
${field['helptext']}
%endfor
<% trans.sa_session.refresh( request ) %>
%for sample_index, sample in enumerate( current_samples ):
%if managing_samples:
${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
%else:
%if sample_index in range( len( request.samples ) ):
${render_sample( sample_index, sample['name'], sample['field_values'], fields_dict )}
%else:
${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
%endif
%endif
%endfor
%def>
## This function displays the "Basic Information" grid
<%def name="render_basic_info_grid()">
Sample Information
%def>
<%def name="show_basic_info_form( sample_index, sample, info )">
${' (required)' }
%if cntrller == 'requests':
%if sample:
%if sample.request.is_unsubmitted:
%else:
%endif
%else:
%endif
%elif is_admin:
%if sample:
%if sample.request.is_unsubmitted:
%else:
%endif
%else:
%endif
%endif
%if sample:
%if sample.request.is_unsubmitted:
Unsubmitted
%else:
${sample.state.name}
%endif
%else:
%endif
${info['library_select_field'].get_html()}
${info['folder_select_field'].get_html()}
%if request.is_submitted or request.is_complete:
<%
if sample:
label = str( len( sample.datasets ) )
else:
label = 'Add'
%>
${label}
%endif
%def>
<%def name="render_sample( index, sample_name, sample_values, fields_dict )">
${sample_name}
%for field_index, field in fields_dict.items():
%if sample_values[field_index]:
%if field['type'] == 'WorkflowField':
%if str(sample_values[field_index]) != 'none':
<% workflow = trans.sa_session.query( trans.app.model.StoredWorkflow ).get( int(sample_values[field_index]) ) %>
${workflow.name}
%endif
%else:
${sample_values[field_index]}
%endif
%else:
None
%endif
%endfor
%def>
<%def name="render_sample_form( index, sample_name, sample_values, fields_dict )">
${sample_name}
%for field_index, field in fields_dict.items():
%if field['type'] == 'TextField':
%elif field['type'] == 'SelectField':
%for option_index, option in enumerate(field['selectlist']):
%if option == sample_values[field_index]:
${option}
%else:
${option}
%endif
%endfor
%elif field['type'] == 'WorkflowField':
%if str(sample_values[field_index]) == 'none':
Select one
%else:
Select one
%endif
%for option_index, option in enumerate(request.user.stored_workflows):
%if not option.deleted:
%if str(option.id) == str(sample_values[field_index]):
${option.name}
%else:
${option.name}
%endif
%endif
%endfor
%elif field['type'] == 'CheckboxField':
%endif
${'('+field['required']+')' }
%endfor
%def>