diff --git a/app/views/entries/_form.html.erb b/app/views/entries/_form.html.erb index 8e9ca66..6b450ba 100644 --- a/app/views/entries/_form.html.erb +++ b/app/views/entries/_form.html.erb @@ -1,146 +1,131 @@ -
- - - -
- -
-

Gesamtsumme: 0h 0min (0min)

-
- - - -<%= form_with(model: entry, local: true) do |form| %> - <% if entry.errors.any? %> -
-

<%= pluralize(entry.errors.count, "Fehler") %> verhinderten das Speichern:

- + +
+
+
⏱️ Zeitberechnung
+ +
+ +
- <% end %> - - - -
-
- - - <%= form.label :date, 'Datum', class: 'form-label' %> - <%= form.date_field :date, - class: 'form-control flatpickr', - data: { - enable_time: false, - altInput: true, - altFormat: 'd.m.Y', - dateFormat: 'Y-m-d' # Wichtig: Flatpickr braucht `dateFormat` - }, - value: (form.object.date) %> -
- - -
- <%= form.label :start_time, 'Beginn (Uhrzeit)', class: 'form-label' %> - <%= form.time_field :start_time, class: 'form-control', step: 60 , discard_month: true, discard_day: true, discard_seconds: true, value: @entry.start_time&.strftime("%H:%M") %> +
+ +

+ Gesamt: 0h 0min (0min) +

+
+
-
- <%= form.label :end_time, 'Ende (Uhrzeit)', class: 'form-label' %> - <%= form.time_field :end_time, class: 'form-control', step: 60 , discard_month: true, discard_day: true, discard_seconds: true, value: @entry.end_time&.strftime("%H:%M") %> -
- - - + +
+
+
📋 Eintrag erstellen
+ + <%= form_with(model: entry, local: true) do |form| %> + <% if entry.errors.any? %> +
+
<%= pluralize(entry.errors.count, "Fehler") %> verhinderten das Speichern:
+
    + <% entry.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+
+ <%= form.label :date, '📅 Datum', class: 'form-label' %> + <%= form.date_field :date, class: 'form-control flatpickr', data: { + enable_time: false, altInput: true, + altFormat: 'd.m.Y', dateFormat: 'Y-m-d' + }, value: form.object.date %> +
+
+ <%= form.label :start_time, '🕒 Beginn', class: 'form-label' %> + <%= form.time_field :start_time, class: 'form-control', step: 60, + value: @entry.start_time&.strftime("%H:%M") %> +
-
- <%= form.label :hours, 'Stunden', class: 'form-label' %> - <%= form.number_field :hours, - class: 'form-control', - min: 0, - value: form.object.hours || 0 %> -
+
+ <%= form.label :end_time, '🕓 Ende', class: 'form-label' %> + <%= form.time_field :end_time, class: 'form-control', step: 60, + value: @entry.end_time&.strftime("%H:%M") %> +
-
- <%= form.label :minutes, 'Minuten', class: 'form-label' %> - <%= form.number_field :minutes, - class: 'form-control', - min: 0, max: 59, - value: form.object.minutes || 0 %> -
+
+ <%= form.label :hours, '⏳ Stunden', class: 'form-label' %> + <%= form.number_field :hours, class: 'form-control', min: 0, + value: form.object.hours || 0 %> +
+
+ <%= form.label :minutes, '⏱ Minuten', class: 'form-label' %> + <%= form.number_field :minutes, class: 'form-control', min: 0, max: 59, + value: form.object.minutes || 0 %> +
-
-
-
- <%= form.check_box :has_break, { class: 'form-check-input', id: 'entry_has_break' }, true, false %> - <%= form.label :has_break, '30 Min. Mittagspause abziehen', class: 'form-check-label ms-2' %> +
+
+ <%= form.check_box :has_break, { class: 'form-check-input', id: 'entry_has_break' }, true, false %> + <%= form.label :has_break, '🧘 30 Min. Mittagspause abziehen', class: 'form-check-label ms-2' %> +
+
-
-
-
+
+

🧮 Berechnet: 0 min

+
+
-
-

Gesamt: 0 min

-
+
+
+ <%= form.label :praktikums_typ, '🔧 Praktikumstyp', class: 'form-label' %> + <%= form.select :praktikums_typ, + current_user.praepedeutikum_abgeschlossen? ? + Entry::PRAKTIKUMSTYPEN.reject { |typ| typ == 'propädeutikum' } : + Entry::PRAKTIKUMSTYPEN, + {}, class: 'form-select' %> +
- -
-
- <%= form.label :praktikums_typ, 'Praktikumstyp', class: 'form-label' %> - <%= form.select :praktikums_typ, - current_user.praepedeutikum_abgeschlossen? ? - Entry::PRAKTIKUMSTYPEN.reject { |typ| typ == 'propädeutikum' } : - Entry::PRAKTIKUMSTYPEN, - {}, - class: 'form-select' %> -
+
+ <%= form.label :entry_art, '📚 Art', class: 'form-label' %> + <%= form.select :entry_art, Entry::ENTRY_ARTEN, {}, class: 'form-select', id: 'entry_art_select' %> +
-
- <%= form.label :entry_art, 'Art', class: 'form-label' %> - <%= form.select :entry_art, Entry::ENTRY_ARTEN, {}, class: 'form-select', id: 'entry_art_select' %> -
+
+ <%= form.label :distance_km, '🚗 Entfernung (km)', class: 'form-label' %> + <%= form.number_field :distance_km, class: 'form-control', min: 0, value: form.object.distance_km || 0 %> +
-
- <%= form.label :distance_km, 'Entfernung (km) Gesamt', class: 'form-label' %> - <%= form.number_field :distance_km, - class: 'form-control', - min: 0, - value: form.object.distance_km || 0 %> -
+
+ <%= form.label :beschreibung, '📝 Beschreibung', class: 'form-label' %> + <%= form.text_field :beschreibung, class: 'form-control' %> +
-
- <%= form.label :beschreibung, 'Beschreibung', class: 'form-label' %> - <%= form.text_field :beschreibung, class: 'form-control' %> -
+
+ <%= form.label :kosten, '💸 Kosten', class: 'form-label' %> + <%= form.number_field :kosten, class: 'form-control', min: 0, step: 0.01 %> +
-
- <%= form.label :kosten, 'Kosten (z. B. Teilnahmegebühr)', class: 'form-label' %> - <%= form.number_field :kosten, class: 'form-control', min: 0, step: 0.01 %> -
-
-
-
- <%= form.check_box :zaehlt_als_fortbildung, class: "form-check-input" %> - <%= form.label :zaehlt_als_fortbildung, "Zählt als Fortbildung", class: "form-check-label" %> +
+
+ <%= form.check_box :zaehlt_als_fortbildung, class: "form-check-input" %> + <%= form.label :zaehlt_als_fortbildung, "🎓 Zählt als Fortbildung", class: "form-check-label" %> +
-
- - +
+ <%= form.submit '💾 Speichern', class: 'btn btn-success' %> + <%= link_to '🔙 Zurück', entries_path, class: 'btn btn-outline-secondary ms-2' %> +
+ <% end %>
+
- -
- <%= form.submit 'Speichern', class: 'btn btn-primary' %> - <%= link_to 'Zurück', entries_path, class: 'btn btn-secondary ms-2' %> -
-<% end %>