feat(instructeurs/procedure/dossiers#extend_conservation): add extends duree conservation in action button list, also rewire this action for user [extend by procedure.duree_conservation_dans_ds by default] but force 1.month for instructeur. add new icon for standby based on https://en.wikipedia.org/wiki/Power_symbol

This commit is contained in:
Martin 2021-12-03 16:09:51 +01:00
parent d8a8d1fdab
commit 081d5094a9
21 changed files with 106 additions and 27 deletions

View file

@ -0,0 +1 @@
<svg height="202" viewBox="-.8 -.5 177 202" width="177" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="30"><path d="m33.7 64.3c-11.6 12.9-18.7 30-18.7 48.7 0 40.1 32.5 72.7 72.7 72.7 40.1 0 72.7-32.5 72.7-72.7 0-18.7-7.1-35.8-18.7-48.7"/><path d="m87.8 15v98"/></g></svg>

After

Width:  |  Height:  |  Size: 334 B

View file

@ -19,6 +19,10 @@
background-image: image-url("icons/unfollow-folder.svg");
}
&.standby {
background-image: image-url("icons/standby.svg");
}
&.archive {
background-image: image-url("icons/archive.svg");
}

View file

@ -19,6 +19,12 @@ module Instructeurs
end
end
def extend_conservation
dossier.update(conservation_extension: dossier.conservation_extension + 1.month)
flash[:notice] = t('views.instructeurs.dossiers.archived_dossier')
redirect_back(fallback_location: instructeur_dossier_path(@dossier.procedure, @dossier))
end
def geo_data
send_data dossier.to_feature_collection.to_json,
type: 'application/json',

View file

@ -168,9 +168,9 @@ module Users
end
def extend_conservation
dossier.update(conservation_extension: dossier.conservation_extension + 1.month)
flash[:notice] = t('.archived_dossier')
redirect_to dossier_path(@dossier)
dossier.update(conservation_extension: dossier.conservation_extension + dossier.procedure.duree_conservation_dossiers_dans_ds.months)
flash[:notice] = t('views.users.dossiers.archived_dossier', duree_conservation_dossiers_dans_ds: dossier.procedure.duree_conservation_dossiers_dans_ds)
redirect_back(fallback_location: dossier_path(@dossier))
end
def modifier

View file

@ -569,6 +569,7 @@ class Dossier < ApplicationRecord
end
def close_to_expiration?
return false if en_instruction?
approximative_expiration_date < Time.zone.now
end

View file

@ -2,7 +2,10 @@
- if dossier.expirable?
%p.expires_at.mb-2
%small= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier), duree_conservation_totale: dossier.duree_totale_conservation_in_months)
%small
= t("shared.dossiers.header.expires_at.#{dossier.state}", date: safe_expiration_date(dossier), duree_conservation_totale: dossier.duree_totale_conservation_in_months)
- if dossier.conservation_extension.positive?
= t('instructeurs.dossiers.header.banner.expiration_date_extended')
-# big banner warning
- if dossier.close_to_expiration?
.card.warning.mb-3
@ -17,7 +20,9 @@
- if dossier.expiration_can_be_extended?
%br
= button_to t('instructeurs.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
= button_to repousser_expiration_instructeur_dossier_path(dossier.procedure, dossier), class: 'button mt-2', id: 'test-instructeur-repousser-expiration' do
%span.icon.standby
= t('instructeurs.dossiers.header.banner.button_delay_expiration')
- else

View file

@ -27,7 +27,8 @@
dossier_id: dossier.id,
state: dossier.state,
archived: dossier.archived,
dossier_is_followed: current_instructeur&.follow?(dossier) }
dossier_is_followed: current_instructeur&.follow?(dossier),
close_to_expiration: dossier.close_to_expiration? }
.state-button

View file

@ -1,9 +1,14 @@
- if Dossier::TERMINE.include?(state)
- if close_to_expiration || Dossier::TERMINE.include?(state)
.dropdown.user-dossier-actions
%button.button.dropdown-button{ 'aria-expanded' => 'false', 'aria-controls' => 'actions-menu' }
Actions
#actions-menu.dropdown-content.fade-in-down
%ul.dropdown-items
- if close_to_expiration
%li
= link_to repousser_expiration_instructeur_dossier_path(procedure_id, dossier_id), method: :post do
%span.icon.standby
.dropdown-description= t('instructeurs.dossiers.header.banner.button_delay_expiration')
- if archived
%li
= link_to unarchive_instructeur_dossier_path(procedure_id, dossier_id), method: :patch do

View file

@ -123,11 +123,12 @@
%a.cell-link{ href: path }= status_badge(p.state)
%td.action-col.follow-col= render partial: 'dossier_actions',
locals: { procedure_id: @procedure.id,
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id) }
locals: { procedure_id: @procedure.id,
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
close_to_expiration: @statut == 'expirant' }
= pagination
- else

View file

@ -81,7 +81,8 @@
dossier_id: p.dossier_id,
state: p.state,
archived: p.archived,
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id) }
dossier_is_followed: @followed_dossiers_id.include?(p.dossier_id),
close_to_expiration: nil }
- else
%td

View file

@ -16,7 +16,9 @@
- if dossier.expiration_can_be_extended?
%br
= button_to t('users.dossiers.header.banner.button_delay_expiration'), users_dossier_repousser_expiration_path(dossier), class: 'button secondary mt-2'
= button_to users_dossier_repousser_expiration_path(dossier), class: 'button mt-2', id: 'test-user-repousser-expiration' do
%span.icon.standby
= t('users.dossiers.header.banner.button_delay_expiration', duree_conservation_dossiers_dans_ds: dossier.procedure.duree_conservation_dossiers_dans_ds)
- else