<%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 name="javascripts()"> ${parent.javascripts()} <% is_admin = cntrller == 'requests_admin' and trans.user_is_admin() %>

Sequencing Request "${request.name}"

Sequencer: ${request.type.name} %if is_admin: | User: ${request.user.email} %endif %if request.is_submitted: | State: ${request.state} %else: | State: ${request.state} %endif
%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

Show Request Information

${request.desc}
%for index, rd in enumerate( request_widgets ): <% field_label = rd[ 'label' ] field_value = rd[ 'value' ] %>
%if field_label == 'State': ${field_value} %else: ${field_value} %endif
%endfor
${request.create_time}
${request.update_time}
<% if request.notification: emails = ', '.join( request.notification[ 'email' ] ) else: emails = '' %> ${emails}
<% if request.notification: states = [] for ss in request.type.states: if ss.id in request.notification[ 'sample_states' ]: states.append( ss.name ) states = ', '.join( states ) else: states = '' %> ${states}

%if current_samples: <% sample_operation_selected_value = sample_operation_select_field.get_selected( return_value=True ) %> ## first render the basic info grid ${render_basic_info_grid()} %if not request.is_new and not managing_samples and len( sample_operation_select_field.options ) > 1:
For selected samples: ${sample_operation_select_field.get_html()}
%if sample_operation_selected_value != 'none' and selected_samples:
%if sample_operation_selected_value == trans.model.Sample.bulk_operations.CHANGE_STATE: ## sample_operation_selected_value == 'Change state'
${sample_state_id_select_field.get_html()}
Optional
%elif sample_operation_selected_value == trans.app.model.Sample.bulk_operations.SELECT_LIBRARY: <% libraries_selected_value = libraries_select_field.get_selected( return_value=True ) %>
${libraries_select_field.get_html()}
%if libraries_selected_value != 'none':
${folders_select_field.get_html()}
%endif %endif
%endif %endif ## Render the other grids <% trans.sa_session.refresh( request.type.sample_form ) %> %for grid_index, grid_name in enumerate( request.type.sample_form.layout ): ${render_grid( grid_index, grid_name, request.type.sample_form.fields_of_grid( grid_index ) )} %endfor %else: %endif %if request.samples and request.is_submitted: %endif %if not managing_samples:
%if request.is_unsubmitted:
%endif
%if current_samples: ${sample_copy.get_html()} %endif %if current_samples and len( current_samples ) <= len( request.samples ): %endif
%endif %if request.samples or current_samples: %if managing_samples:
%elif len( current_samples ) > len( request.samples ):
%endif %endif

%if request.is_unsubmitted:

Show Import samples


The csv file must be in the following format:
SampleName,DataLibrary,DataLibraryFolder,FieldValue1,FieldValue2...
%endif <%def name="render_grid( grid_index, grid_name, fields_dict )">
<% if not grid_name: grid_name = "Grid "+ grid_index %>
%if managing_samples or len( current_samples ) > len( request.samples ):

Show ${grid_name}

%else:

Hide ${grid_name}

%endif %for index, field in fields_dict.items(): %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
Name ${field['label']}
${field['helptext']}
## This function displays the "Basic Information" grid <%def name="render_basic_info_grid()">

Sample Information

%if request.is_submitted or request.is_complete: %endif <% trans.sa_session.refresh( request ) %> %for sample_index, info in enumerate( current_samples ): <% if sample_index in range( len(request.samples ) ): sample = request.samples[sample_index] else: sample = None %> %if managing_samples: ${show_basic_info_form( sample_index, sample, info )} %else: %if sample_index in range( len( request.samples ) ): %if trans.security.encode_id( sample.id ) in selected_samples: %else: %endif %if sample.request.is_unsubmitted: %else: %endif %if info['library']: %if cntrller == 'requests': %elif is_admin: %endif %else: %endif %if info['folder']: %else: %endif %if request.is_submitted or request.is_complete: %endif %else: ${show_basic_info_form( sample_index, sample, info )} %endif %if request.is_unsubmitted or request.is_rejected: %endif %endif %endfor
Name Barcode State Data Library FolderDatasets Transferred
${info['name']} ${info['barcode']}Unsubmitted${render_sample_state( sample )}${info['library'].name}${info['library'].name}${info['folder'].name} ${render_sample_datasets( sample )} %if sample: %if sample.request.is_unsubmitted: %endif %endif
<%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 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 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': %elif field['type'] == 'WorkflowField': %elif field['type'] == 'CheckboxField': %endif
${'('+field['required']+')' }
%endfor