<%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full' do %> <%= hidden_field_tag :controller_id, params[:id] %>
<%= @controller.name %> 컨트롤러
<%= submit_tag "업데이트", class: "btn bg-primary" %>
    <% if @schedule.present? %> <% @schedule.each do |s| %>
  • 시간
    <%= select_tag "schedule[#{s.id}][hour]", options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour), class: "select-style text-white min-w-[60px]" %>
    :
    <%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style min-w-[60px]" %>
    온도 (°C)
    <%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, min: -99, max: 99, step: "0.1", inputmode: "decimal", class: "input-style min-w-[68px] h-full" %>
    ON/OFF
     
    <%= link_to schedule_path(s), data: { turbo_method: :delete, turbo_confirm: "정말 삭제하시겠습니까?" }, class: "btn bg-danger text-sm flex items-center px-2 py-0 my-1.5 lg:px-4 lg:py-1.5 lg:my-0" do %>
    <% end %>
  • <% end %> <% else %>
  • 저장된 스케줄이 없습니다.
  • <% end %>
<% end %>
<%= button_to "초기화", reset_schedule_path(params[:id]), method: :post, data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." }, class: "btn bg-danger" %> <%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]), class: "btn bg-default-slate", data: { turbo_method: :post, turbo_frame: "modals" } %>