_citizens_history_table.html.erb 4.58 KB
Newer Older
1
2
3
<%= page_entries_info schedules %>
<% if !schedules.empty? %>
  <div class="table-border">
4
5
    <table class=" lighten-4 striped centered responsive-table">
      <thead>
6
        <tr class="">
7
          <th data-field="no">No.</th>
8
9
10
          <th data-field="sector"><%= t(:Sector) %></th>
          <th data-field="service_place"><%=t(:service_place)%></th>
          <th data-field="service_type"><%= t(:service_type) %></th>
11
          <% if @currentCityHall.show_professional %>
12
            <th><%= t(:Professional) %></th>
13
          <% end %>
14
15
16
17
18
          <th data-field="date"><%= t(:Date) %></th>
          <th data-field="time"><%= t(:Time) %></th>
          <th data-field="obs" style="word-wrap: break-word;"><%= t(:Note) %></th>
          <th data-field="situation"><%= t(:Situation) %></th>
          <th data-field="checking_copy"><%= t(:checking_copy) %></th>
19
20
21
22
23
          <% if @pode_cancelar %>
            <th></th>
          <% end %>
        </tr>
      </thead>
24

25
      <tbody>
26
        <% schedules.each do |schedule| %>
27
28
29
30
31
          <tr>
            <td><%= schedule.id %></td>
            <td><%= schedule.shift.service_type.sector.name %> </td>
            <td>
              <% if schedule.service_place.nil? %>
32
                ERRO: <%= t(:Schedule) %> não possui <%=t(:service_place)%>, por favor contate o suporte!
33
34
35
36
37
38
              <% else %>
                <%= schedule.service_place.name %>
              <% end %>
            </td>
            <td>
              <% if schedule.shift.nil? %>
39
                ERRO:<%= t(:Schedule) %> não possui <%= t(:shift) %>, por favor contate o suporte!
40
              <% elsif schedule.shift.service_type.nil? %>
41
                ERRO: <%= t(:Schedule) %> não possui <%= t(:service_type) %>, por favor
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
      contate o suporte!
              <% else %>
                <%= schedule.shift.service_type.description %>
              <% end %>
            </td>
            <% if @currentCityHall.show_professional %>
              <td>
                <% if schedule.shift.professional_2 %>
                  <%= schedule.shift.professional_2.name %>
                <% else %>
                  Não especificado
                <% end %>
              </td>
            <% end %>
            <td><%= schedule.shift.execution_start_time.strftime("%d/%m/%Y") if !schedule.shift.nil? %></td>
            <td><%= schedule.service_start_time.strftime("%H:%M") %></td>
            <td style="word-wrap: break-word;"><%= schedule.note %></td>
            <td>
              <% if schedule.situation.nil? %>
61
                ERRO: <%= t(:Schedule) %> não possui <%= t(:situation) %>, por favor contate o suporte!
62
63
64
65
66
67
68
69
70
71
72
73
74
75
              <% else %>
                <%= schedule.situation.description %>
              <% end %>
            </td>
            <td class="actions">
              <% if (schedule.service_start_time >= Time.now) %>
                <%= button_to citizen_comprovante_path(schedule.id), :class => "transparent" do %>
                  <i class="waves-effect material-icons tooltipped agendador-icon"  data-position="top" data-delay="50" data-tooltip="Imprimir" id="table-buttons-actions" >print</i>
                <% end %>
              <% else %>
                Não disponível
              <% end %>
            </td>
              <% if @pode_cancelar %>
76
                <td>
77
                  <% if schedule.can_cancel?(DateTime.now + schedule.shift.service_type.sector.prior_cancel_hours.hours, Date.today) %>
Mateus Ravedutti's avatar
Mateus Ravedutti committed
78
79
80
                    <a class="waves-effect tooltipped modal-trigger has-modal" data-position="top" data-delay="50" data-tooltip="Cancelar" href="#modal_update_citizen_schedule_<%=schedule.id%>">
                      <i class="material-icons update_citizen_schedule agendador-icon" id="table-buttons-actions">cancel</i>
                    </a>
81
                  <% end %>
82
                </td>
83
84
85
86
87
88
89
              <% end %>
          </tr>
        <% end %>
      </body>
    </table>
  </div>
<% end %>
Mateus Ravedutti's avatar
Mateus Ravedutti committed
90
91
92
93
94
95
96
97
98
99
100
101
102
<% @schedules.each do |schedule| %>
  <div id="modal_update_citizen_schedule_<%=schedule.id%>" class="modal">
    <div class="modal-content">
      <h4 id="update-citizen-schedule-header">Cancelar agendamento</h4>
      <p>Deseja realmente cancelar este agendamento?</p>
    </div>  
    <div class="modal-footer">
      <a href="#!" class="modal-action modal-close waves-effect waves-red btn-flat left">Não</a>
      <%= link_to "Sim", { :controller => "citizens", :action => "destroy",
                          :id => schedule.id }, :method => :delete, :class => "modal-action modal-close waves-effect waves-green btn-flat" %>
    </div>
  </div>
<% end %>
103
<%= will_paginate schedules, :renderer => Pagination %>