diff --git a/app/models/presenters/plate_presenter.rb b/app/models/presenters/plate_presenter.rb index 45bf3727d..48cc48f0f 100644 --- a/app/models/presenters/plate_presenter.rb +++ b/app/models/presenters/plate_presenter.rb @@ -190,6 +190,10 @@ def display_manual_transfer_button? can_be_enabled?(purpose_config.dig(:manual_transfer, :states)) end + def disable_workflow_creation? + false + end + private def libraries_passable? diff --git a/app/models/presenters/stock_plate_with_submission_presenter.rb b/app/models/presenters/stock_plate_with_submission_presenter.rb new file mode 100644 index 000000000..bbaa23b7d --- /dev/null +++ b/app/models/presenters/stock_plate_with_submission_presenter.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Presenters + # + # Presenters::StockPlateWithSubmissionPresenter is used for stock plates + # which have a submission sidebar when passed. + # This is used for the LCM Triomics pipeline, where the stock plate is used as + # the input plate for the submission, and the user should be able to create + # the submission when the plate is passed. + # + class StockPlateWithSubmissionPresenter < SubmissionPlatePresenter + include Presenters::StockBehaviour + include Presenters::Statemachine::SubmissionWhenPassed + + validates_with Validators::SuboptimalValidator + validates_with Validators::ActiveRequestValidator + + def allow_new_submission? + true + end + + def submission_in_progress? + labware.requests_in_progress.any? + end + + def requests_pending? + labware.all_requests.any?(&:pending?) + end + + def disable_workflow_creation? + return true if pending_submissions? || requests_pending? + + false + end + end +end diff --git a/app/views/plates/_choose_workflow.html.erb b/app/views/plates/_choose_workflow.html.erb index 3374c0bdd..f902bf50c 100644 --- a/app/views/plates/_choose_workflow.html.erb +++ b/app/views/plates/_choose_workflow.html.erb @@ -45,7 +45,7 @@ <% end %> <% end %> - <%= submit_tag name, class: 'create-submission-button' %> + <%= submit_tag name, class: 'create-submission-button', disabled: presenter.disable_workflow_creation? %> <% end %> <% end %> <% end %> diff --git a/config/purposes/lcm_triomics.yml b/config/purposes/lcm_triomics.yml index 3154f8001..b27a1d8f8 100644 --- a/config/purposes/lcm_triomics.yml +++ b/config/purposes/lcm_triomics.yml @@ -5,8 +5,23 @@ LCMT Lysate: :stock_plate: true :cherrypickable_target: false :input_plate: true - :presenter_class: Presenters::StockPlatePresenter + :presenter_class: Presenters::StockPlateWithSubmissionPresenter :creator_class: LabwareCreators::Uncreatable + :submission_options: + EM-seq (+ WGS) Branch - Automated Submission: + template_name: 'Limber-Htp - LCM Triomics EMSeq' + allowed_extra_barcodes: false + request_options: + library_type: 'emSEQ' + fragment_size_required_from: '450' + fragment_size_required_to: '450' + RNA-Seq Branch - Automated Submission: + template_name: 'Limber-Htp - LCM Triomics RNASeq' + allowed_extra_barcodes: false + request_options: + library_type: 'Combined LCM RNA' + fragment_size_required_from: '100' + fragment_size_required_to: '500' :size: 96 LCMT DNA Frag: :asset_type: plate