1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
  | 
/ PageHeader
= pageheader 'map-marker',
             @referential.name,
             'Lorem ipsum dolor sit amet',
             t('last_update', time: l(@referential.updated_at, format: :short)),
             link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default') do
  / Below is secundary actions & optional contents (filters, ...)
  .row.mb-sm
    .col-lg-12.text-right
      / Actions are: controler, rapport de controle, dupliquer, purger, conserver, supprimer
      = link_to t('actions.clone'), new_referential_path(from: @referential.id), class: 'btn btn-primary'
      button.btn.btn-primary type='button' data-toggle='modal' data-target='#purgeModal' Purger
      - if @referential.archived?
        = link_to t('actions.unarchive'), unarchive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
      - else
        = link_to t('actions.archive'), archive_referential_path(@referential.id), method: :put, class: 'btn btn-primary'
      = link_to t('actions.destroy'), referential_path(@referential), method: :delete, data: {confirm: t('referentials.actions.destroy_confirm')}, class: 'btn btn-primary'
/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-12
        .page_metalist
          .pm-col
            - if @referential.archived?
              .pm-item
                span.label.label-default
                  strong = "#{@referential.human_attribute_name(:archived_at)} : "
                  = l(@referential.archived_at, format: :short)
            - else
              .pm-item
                strong = "#{@referential.human_attribute_name(:archived_at)} : "
            .pm-item
              strong = "#{@referential.human_attribute_name(:validity_period)} : "
              - if @referential.validity_period
                = t('validity_range', debut: l(@referential.try(:validity_period).try(:begin), format: :short), end: l(@referential.try(:validity_period).try(:end), format: :short))
          .pm-col
            .pm-item
              strong = "Organisation : "
              = @referential.organisation.name
            .pm-item
              strong = "#{@referential.human_attribute_name(:published_at)} : "
              = ""
  
    - if @reflines.any?
      .row
        .col-lg-5.col-md-6.col-sm-6.col-xs-8
          = search_form_for @q, url: referential_path(@referential.id) do |f|
            .input-group.search_bar
              = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de ligne'
              span.input-group-btn
                button.btn.btn-default type='submit'
                  span.fa.fa-search
        .col-lg-7.col-md-6.col-sm-6.col-xs-4.text-right
          = new_pagination @reflines
      .row.mt-sm
        .col-lg-12
          = render 'filters'
          / ID Codif, nom court, nom de la ligne, réseau, mode, transporteur principal, actions = [show, edit_notes]
          = table_builder @reflines,
            { 'ID Codif' => Proc.new { |n| n.objectid.local_id }, @reflines.human_attribute_name(:registration_number) => 'registration_number',
            @reflines.human_attribute_name(:name) => 'name', @reflines.human_attribute_name(:network) => Proc.new { |n| n.try(:network).try(:name) },
            @reflines.human_attribute_name(:transport_mode) => 'transport_mode',
            @reflines.human_attribute_name(:company) => Proc.new { |n| n.try(:company).try(:name) } },
            [:show],
            [],
            'table'
          = new_pagination @reflines, 'pull-right'
    - else
      = replacement_msg t('referential_lines.search_no_results')
/ Modal(s)
= modalbox 'purgeModal' do
  = simple_form_for [@referential, CleanUp.new] do |f|
    .modal-header
      h4.modal-title Purger le JDD
    .modal-body
      .container-fluid
        .row
          .col-lg-8.col-ld-offset-2.col-md-8.col-md-offset-2.col-sm-8.col-sm-offset-2.col-xs-12
            = f.input :begin_date, as: :date, label: t('titles.clean_up.begin_date'),:wrapper_html => { class: 'date', title: t('titles.clean_up.begin_date') }
            = f.input :end_date, as: :date, label: t('titles.clean_up.end_date'), :wrapper_html => { class: 'date', title: t('titles.clean_up.end_date') }
    .modal-footer
      button.btn.btn-link type='button' data-dismiss='modal' Annuler
      = f.button :submit, t('actions.clean_up') , class: 'btn btn-primary'
  |