컨트롤러 2개 조절

This commit is contained in:
2025-04-23 10:58:50 +09:00
parent 9291a5d1db
commit 2434c5b7aa
16 changed files with 106 additions and 100 deletions

View File

@@ -1,42 +1,7 @@
<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>
<tbody>
<% @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 %>
</tbody>
</table>
<div>
<div class="flex gap-x-2">
<%= button_to "스케쥴러 시작", start_modbus_index_path, method: :post, class: "btn bg-accept" %>
<%= button_to "스케쥴러 정지", stop_modbus_index_path, method: :post, class: "btn bg-danger" %>
</div>
<div class="py-4">
<span class="font-semibold">스케쥴러 상태:</span>
<% if @modbus_running %>
<span class="text-accept font-bold">실행 중</span>
<% else %>
<span class="text-danger font-bold">정지됨</span>
<% end %>
</div>
</div>
</div>
<div class="flex p-4">
<%= link_to "수정", schedule_edit_schedules_path, class: "btn bg-default-slate" %>
<div class="p-4">
<div class="flex flex-wrap gap-2 justify-center">
<% @controllers.each do |c| %>
<%= link_to c.name, view_schedule_path(c.id), class: "btn bg-primary" %>
<% end %>
</div>
</div>

View File

@@ -1,5 +1,7 @@
<%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full divide-y divide-border-table-border' do %>
<%= hidden_field_tag :controller_id, params[:id] %>
<div class="flex-1 p-4">
<span class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</span>
<table class="base-table">
<thead>
<tr>
@@ -40,13 +42,13 @@
</div>
<% end %>
<div class="flex p-4">
<%= button_to "초기화", reset_schedules_path,
<%= button_to "초기화", reset_schedule_path(params[:id]),
method: :post,
data: { turbo_confirm: "정말 초기화하시겠습니까? 모든 스케줄 데이터가 삭제됩니다." },
class: "btn bg-danger" %>
</div>
<div class="flex p-4">
<%= button_to "추가하기", open_modals_path(type: "add_schedule"),
<%= button_to "추가하기", open_modals_path(type: "add_schedule", id: params[:id]),
class: "btn bg-default-slate",
data: {
turbo_method: :post,

View File

@@ -0,0 +1,28 @@
<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">
<span class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</span>
<table class="base-table">
<thead>
<tr>
<th>시간</th>
<th>분</th>
<th>사용여부</th>
<th>온도</th>
</tr>
</thead>
<tbody>
<% @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 %>
</tbody>
</table>
</div>
<div class="flex p-4">
<%= link_to "수정", schedule_edit_schedule_path(@controller.id), class: "btn bg-default-slate" %>
</div>
</div>