분 추가 (스케쥴 new 추가 필요)

This commit is contained in:
2025-04-18 15:54:19 +09:00
parent cd7620672f
commit eb3bc33509
10 changed files with 127 additions and 48 deletions

View File

@@ -23,12 +23,21 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
</head>
<body class="h-screen">
<body>
<%= turbo_frame_tag :modals %>
<main class="flex flex-col h-full divide-y divide-border-table-border">
<%= render "partials/header" %>
<div class="flex flex-row flex-1 w-full divide-x divide-border-table-border">
<div class="w-full h-full">
<% if flash[:notice] %>
<div class="m-4 rounded px-4 py-2 bg-accept text-white">
<%= flash[:notice] %>
</div>
<% elsif flash[:alert] %>
<div class="m-4 rounded px-4 py-2 bg-danger text-white">
<%= flash[:alert] %>
</div>
<% end %>
<%= yield %>
</div>
</div>

View File

@@ -1,18 +1,11 @@
<% if flash[:notice] %>
<div class="m-4 rounded px-4 py-2 bg-accept text-white">
<%= flash[:notice] %>
</div>
<% elsif flash[:alert] %>
<div class="m-4 rounded px-4 py-2 bg-danger text-white">
<%= flash[:alert] %>
</div>
<% end %>
<div class="flex flex-col h-full divide-y divide-border-table-border">
<div class="flex flex-col flex-1 p-4 space-y-4">
<table class="base-table">
<thead>
<tr>
<th>시간</th>
<th>분</th>
<th>사용여부</th>
<th>온도</th>
</tr>
</thead>
@@ -20,6 +13,8 @@
<% @schedule.each do |s| %>
<tr>
<td><%= s.hour %>시</td>
<td><%= s.minute %>분</td>
<td><%= s.is_active %></td>
<td><%= s.temperature %> °C</td>
</tr>
<% end %>

View File

@@ -4,15 +4,30 @@
<thead>
<tr>
<th>시간</th>
<th>분</th>
<th>사용여부</th>
<th>온도</th>
<th>삭제</th>
</tr>
</thead>
<tbody>
<% @schedule.each do |s| %>
<tr>
<td><%= s.hour %>시</td>
<td><%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "border px-2 py-1 rounded" %>
°C
<td>
<%= select_tag "schedule[#{s.id}][hour]",
options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour),
class: "input-style" %>
</td>
<td><%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %></td>
<td><%= check_box_tag "schedule[#{s.id}][is_active]", "1", s.is_active == true || s.is_active == 1 %></td>
<td><%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %></td>
<td>
<%= link_to "삭제", modbus_path(s),
data: {
turbo_method: :delete,
turbo_confirm: "정말 삭제하시겠습니까?"
},
class: "btn bg-danger text-sm" %>
</td>
</tr>
<% end %>