Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/admin/operator_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def perform_qc_params
index do
selectable_column
column :public
tag_column :status
tag_column :status, &:detailed_status
column :id
column I18n.t("activerecord.models.country.one") do |od|
od.required_operator_document.country
Expand Down Expand Up @@ -196,6 +196,8 @@ def perform_qc_params
column I18n.t("active_admin.operator_documents_page.attachment") do |od|
if od&.document_file&.attachment
link_to od.document_file.attachment.identifier, od.document_file.attachment.url
elsif od.reason.present?
I18n.t("active_admin.operator_documents_page.non_applicable")
end
end
column I18n.t("active_admin.operator_documents_page.annexes") do |od|
Expand Down Expand Up @@ -271,15 +273,19 @@ def perform_qc_params
show title: proc { "#{resource.operator.name} - #{resource.required_operator_document.name}" } do
attributes_table do
row :public
tag_row :status
tag_row :status, &:detailed_status
row(I18n.t("active_admin.operator_documents_page.reason_label"), &:reason) if resource.reason.present?
row :admin_comment if resource.admin_comment.present?
row :required_operator_document
row :operator
row :fmu, unless: resource.is_a?(OperatorDocumentCountry)
row :uploaded_by
row I18n.t("active_admin.operator_documents_page.attachment") do |r|
link_to r.document_file&.attachment&.identifier, r.document_file&.attachment&.url, target: "_blank", rel: "noopener" if r.document_file&.attachment&.present?
if r.document_file&.attachment&.present?
link_to r.document_file&.attachment&.identifier, r.document_file&.attachment&.url, target: "_blank", rel: "noopener"
elsif r.reason.present?
I18n.t("active_admin.operator_documents_page.non_applicable")
end
end
row :start_date
row :expire_date
Expand Down
6 changes: 3 additions & 3 deletions app/admin/operator_document_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

index do
column :public
tag_column :status
tag_column :status, &:detailed_status
column :id
column :admin_comment
column :operator_document do |od|
Expand Down Expand Up @@ -171,7 +171,7 @@
# link_to history.id, admin_operator_document_history_path(history)
link_to history.operator_document_updated_at.to_datetime.to_fs(:long), admin_operator_document_history_path(history)
end
tag_column :status
tag_column :status, &:detailed_status
end
end
end
Expand All @@ -186,7 +186,7 @@
end
end
row :public
tag_row :status
tag_row :status, &:detailed_status
row(I18n.t("active_admin.operator_documents_page.reason_label"), &:reason) if resource.reason.present?
row :admin_comment if resource.admin_comment.present?
row :required_operator_document
Expand Down
8 changes: 5 additions & 3 deletions app/assets/javascripts/quality_controls.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
$(document).ready(function() {
updateQCFields();
$('input[name="quality_control[decision]"]').on('change', function(){
if ($('input[name="quality_control[decision]"]').length) {
updateQCFields();
})
$('input[name="quality_control[decision]"]').on('change', function(){
updateQCFields();
})
}
})

function updateQCFields() {
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/active_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ $to-be-reviewed: #99AA99;
&.rejected { background: $rejected-color; }
&.approved { background: $approved-color; }
&.doc_pending { background: $pending-color; }
&.doc_pending_non_applicable { background: $pending-color; }
&.doc_invalid { background: $rejected-color; }
&.doc_valid { background: $approved-color; }
&.doc_expired { background: $expired-color; }
Expand Down
6 changes: 6 additions & 0 deletions app/models/operator_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def name_with_fmu
"#{required_operator_document.name} (#{fmu.name})"
end

def detailed_status
return "doc_pending_non_applicable" if doc_pending? && reason.present?

status
end

def destroy # rubocop:disable Rails/ActiveRecordOverride
# It only allows for (soft) deletion of the operator documents when:
# 1 - The Operator was deleted (destroyed_by_association)
Expand Down
6 changes: 6 additions & 0 deletions app/models/operator_document_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def needs_authorization_before_downloading?
true
end

def detailed_status
return "doc_pending_non_applicable" if doc_pending? && reason.present?

status
end

# Returns the collection of OperatorDocumentHistory for a given operator at a point in time
#
# @param String operator_id The operator id
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ en:
operator_document_id: 'Operator Document ID'
with_deleted: 'With deleted'
reason_label: "Reason for putting document as “non applicable”"
non_applicable: "Non applicable"
operator_document_annexes_page:
approved: 'Annex approved'
not_approved: 'Annex could not be approved'
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ es:
operator_document_id: 'ID de Documento del Operador'
with_deleted: 'Con eliminados'
reason_label: "Razón para marcar documento como \"no aplicable\""
non_applicable: "No aplicable"
operator_document_annexes_page:
approved: 'Anexo aprobado'
not_approved: 'No se pudo aprobar el anexo'
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ fr:
operator_document_id: "ID de document de l'opérateur"
with_deleted: 'Avec supprimé'
reason_label: "Le document a été mis comme non applicable avec l'explication suivante"
non_applicable: "Non applicable"
operator_document_annexes_page:
approved: 'Annexe approuvée'
not_approved: "L'annexe n'a pas pu être approuvée"
Expand Down
Loading