aboutsummaryrefslogtreecommitdiffstats
path: root/views/baby.slim
blob: f6a4b2e79e220060dc6a89c0bdda16059a8ea704 (plain) (blame)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
h1 = @baby.name

- baby_age = @baby.age(@today)
- today_short = @today.strftime('%Y%m%d')

h2
  | J#{baby_age}
  =< @today.strftime('%d/%m/%Y')

p
  - if baby_age > 0
    a.button> href="/#{@baby.id}/#{(@today - 1).strftime('%Y%m%d')}"
      | ← #{R18n.t.biberon.yesterday}
  a.button> href="/#{@baby.id}" = R18n.t.biberon.today
  - if @today < Date.today
    a.button< href="/#{@baby.id}/#{(@today + 1).strftime('%Y%m%d')}"
      | #{R18n.t.biberon.tomorrow} β†’

table.biblist
  thead
    tr
      th = R18n.t.biberon.hour
      th = R18n.t.biberon.quantity
      - if @settings.include?('t')
        th = R18n.t.biberon.temp
      th = R18n.t.biberon.feces
      - if @settings.include?('u')
        th = R18n.t.biberon.urines
      - if @settings.include?('v')
        th = R18n.t.biberon.vitamind
      - if @settings.include?('w')
        th = R18n.t.biberon.weight
      - if @settings.include?('c')
        th = R18n.t.biberon.comment
      th = R18n.t.biberon.actions
  tbody
    - @baby.bibs_of_day(@today).each do |bib|
      tr
        td = bib.hour
        td = bib.quantity
        - if @settings.include?('t')
          td = bib.temperature
        td
          - if bib.feces
            | πŸ’©
        - if @settings.include?('u')
          td
            - if bib.urines
              | πŸ’¦
        - if @settings.include?('v')
          td
            - if bib.vitamind
              | βœ…
        - if @settings.include?('w')
          td = bib.weight
        - if @settings.include?('c')
          td = bib.comment
        td
          form action="/#{@baby.id}/delete" method='post'
            fieldset
              == csrf_tag "/#{@baby.id}/delete"
              input type='hidden' name='date' value=today_short
              input type='hidden' name='time' value=bib.hour
              button.button-outline[type='submit'
                aria-label=R18n.t.delete title=R18n.t.delete]
                | πŸ—‘οΈ
  thead
    tr
      th
        ' 🍼
        = R18n.t.biberon.total_of_day
      th colspan='8' = @baby.total_bibs_of_day(@today)

p.center-text
  a.button.button-outline href="/#{@baby.id}/graph" = R18n.t.biberon.show_graph

form action="/#{@baby.id}/add" method='post'
  fieldset
    == csrf_tag "/#{@baby.id}/add"

    - if @errors&.any?
      ul.errors
        - @errors.each do |field, err|
          - err.each do |message|
            li
              | #{R18n.t.biberon[field]} #{message}


    input type='hidden' name='date' value=today_short

    label for='time'
      ' ⏰
      = R18n.t.biberon.hour
    input#time type='time' name='time' value=DateTime.now.strftime('%H:%M')

    label for='quantity'
      ' 🍼
      = R18n.t.biberon.quantity
    input#quantity type='number' name='quantity' min='0'

    - if @settings.include?('c')
      label for='comment'
        ' πŸ“
        = R18n.t.biberon.comment
      textarea#comment name='comment'

    - if @settings.include?('w')
      label for='weight'
        ' βš–οΈ
        = R18n.t.biberon.weight
      input#weight type='number' name='weight' min='0'

    - if @settings.include?('t')
      label for='temperature'
        ' 🌑️
        = R18n.t.biberon.temperature
      input#temperature type='number' name='temperature' min='30' step='0.1'

    div.row
      div.column.column-33
        input#feces type='checkbox' name='feces'
        label.label-inline for='feces' = R18n.t.biberon.feces

      - if @settings.include?('u')
        div.column.column-33
          input#urines type='checkbox' name='urines'
          label.label-inline for='urines' = R18n.t.biberon.urines

      - if @settings.include?('v')
        div.column.column-33
          input#vitamind type='checkbox' name='vitamind'
          label.label-inline for='vitamind' = R18n.t.biberon.vitamind

    input.button-primary type='submit' value=R18n.t.save
    input.button-outline< type='reset' value=R18n.t.cancel