Compare commits

..

No commits in common. "f7cedfd799e18a30547e5c2d1173b37411b787b6" and "2f237acaecde53d344441b680af825164da37014" have entirely different histories.

9 changed files with 72 additions and 166 deletions

View File

@ -14,7 +14,7 @@
/* theme */
--color-base-background: rgb(39, 44, 56);
--color-base-secondary: rgb(55, 61, 71);
--color-base-text: rgb(255, 255, 255);
--color-base-text: rgb(152, 158, 172);
--color-base-border: rgb(77, 84, 102);
--base-font-size: 0.85rem;
@ -78,29 +78,16 @@
}
.select-style {
@apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs text-base-background
}
.select-style option {
color: theme('colors.base-background');
@apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs
}
.input-style {
@apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs
@apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs
}
.textarea-style {
@apply block w-full pl-4 flex-1 py-1.5 ring-1 ring-inset ring-default-slate/50 rounded-xs
}
/*Toggle Button*/
.toggle_style {
@apply w-14 h-8 bg-danger rounded-full peer-checked:bg-notice transition-all duration-300
}
.toggle_btn {
@apply absolute left-1 top-1 w-6 h-6 bg-white rounded-full transition-all duration-300 peer-checked:translate-x-full shadow-sm
}
}
@layer utilities {
@ -196,7 +183,7 @@
}
.base-table th {
@apply bg-base-background px-2 py-2 text-left font-bold lg:table-cell
@apply bg-base-text px-2 py-2 text-left font-bold lg:table-cell
}
.base-table td {

View File

@ -10,8 +10,5 @@ application.register("hello", HelloController)
import ModalsController from "./modals_controller"
application.register("modals", ModalsController)
import SidebarController from "./sidebar_controller"
application.register("sidebar", SidebarController)
import TimerController from "./timer_controller"
application.register("timer", TimerController)

View File

@ -1,15 +0,0 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["menu", "overlay"]
toggle() {
this.menuTarget.classList.toggle("-translate-x-full")
this.overlayTarget.classList.toggle("hidden")
}
close() {
this.menuTarget.classList.add("-translate-x-full")
this.overlayTarget.classList.add("hidden")
}
}

View File

@ -25,11 +25,11 @@
<body class="min-h-screen bg-base-background text-base-text min-w-[400px] overflow-x-auto h-full">
<%= turbo_frame_tag :modals %>
<main class="flex flex-col h-full" data-controller="sidebar">
<main class="flex flex-col h-full">
<%= render "partials/header" %>
<div class="flex flex-row flex-1 w-full">
<%= render "partials/sidebar" %>
<div class="flex-1 h-full pb-4 px-4 md:pl-0">
<div class="flex-1 h-full pb-4 pr-4">
<div class="flex-1 h-full content">
<% if flash[:notice] %>
<div class="rounded px-4 py-2 bg-accept text-white">

View File

@ -1,14 +1,9 @@
<header class="flex header justify-between items-center">
<div class="flex flex-row h-full items-center">
<%= image_tag "svg/svg_logo.svg", class: "w-auto h-8 mr-4" %>
<header class="flex header" data-controller="timer">
<div class="flex flex-row h-full">
<%= image_tag "svg/svg_logo.svg", class: "w-fit h-auto mr-4" %>
<%= link_to root_path do %>
<div class="flex h-full items-center tracking-[0.5rem]">FARMITRY</div>
<% end %>
</div>
<div data-timer-target="output" class="hidden md:block"></div>
<button data-action="click->sidebar#toggle" class="block md:hidden p-2 cursor-pointer">
<i class="fa-solid fa-bars text-2xl"></i>
</button>
<div data-timer-target="output"></div>
</header>

View File

@ -1,5 +1,4 @@
<div data-sidebar-target="overlay" data-action="click->sidebar#close" class="fixed inset-0 bg-black/50 z-40 hidden md:hidden"></div>
<nav class="side-bar overflow-y-auto transition-transform md:translate-x-0 -translate-x-full fixed md:relative top-0 left-0 h-full bg-base-background z-50" data-sidebar-target="menu">
<nav class="side-bar overflow-y-auto">
<div class="menu-group">
<div class="menu-group-icon">
<i class="fa-solid fa-house text-base-text/30 text-4xl"></i>

View File

@ -1,62 +1,45 @@
<div class="flex flex-col h-full text-white overflow-y-auto">
<div class="flex flex-col h-full text-white overflow-y-auto ">
<div class="flex flex-col flex-1 divide-y divide-base-border">
<%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full' do %>
<%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full divide-y divide-border-base-border p-4' do %>
<%= hidden_field_tag :controller_id, params[:id] %>
<div class="divide-y divide-base-border">
<div class="flex justify-between p-4">
<div class="space-y-4">
<div class="flex justify-between">
<div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div>
<%= submit_tag "업데이트", class: "btn bg-primary" %>
</div>
<ul class="divide-y divide-base-border whitespace-nowrap">
<table class="base-table">
<thead>
<tr>
<th>시간</th>
<th>분</th>
<th>사용여부</th>
<th>온도</th>
<th>삭제</th>
</tr>
</thead>
<tbody>
<% @schedule.each do |s| %>
<li class="flex justify-between items-center px-4 py-2 space-x-4">
<div class="flex items-center space-x-4 basis-2/3">
<!-- 시간 -->
<div class="flex flex-col md:flex-row w-full items-center space-x-0 space-y-2 md:space-x-2 md:space-y-0">
<div class="text-white">시간</div>
<div class="text-xl flex items-center space-x-1">
<%= 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" %>
<div>:</div>
<%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %>
</div>
</div>
<!-- 온도 -->
<div class="flex flex-col md:flex-row w-full items-center space-x-0 space-y-2 md:space-x-4 md:space-y-0">
<div class="text-white">온도</div>
<div class="text-xl flex items-center space-x-2">
<div>
<%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %>
</div>
<div class="text-white text-xl leading-8">°C</div>
</div>
</div>
</div>
<div class="flex items-center space-x-6 basis-1/3 justify-end">
<!-- 사용 여부 -->
<div class="flex flex-col md:flex-row items-center space-x-0 space-y-2 md:space-x-4 md:space-y-0">
<div class="text-white">사용여부</div>
<label class="relative inline-flex items-center cursor-pointer">
<%= check_box_tag "schedule[#{s.id}][is_active]", "1", s.is_active == true || s.is_active == 1, class: "sr-only peer" %>
<div class="toggle_style"></div>
<div class="toggle_btn"></div>
</label>
</div>
<!-- 삭제 -->
<tr>
<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 "삭제", schedule_path(s),
data: {
turbo_method: :delete,
turbo_confirm: "정말 삭제하시겠습니까?"
},
class: "btn bg-danger text-sm" %>
</div>
</li>
</td>
</tr>
<% end %>
</ul>
</tbody>
</table>
</div>
<% end %>
<div class="flex p-4 space-x-4">

View File

@ -1,70 +1,30 @@
<div class="flex flex-col h-full divide-y divide-base-border text-white">
<div class="flex flex-col flex-1 space-y-4 overflow-y-hidden">
<div class="overflow-y-auto divide-y divide-base-border">
<div class="flex justify-between p-4">
<div class="flex flex-col flex-1 p-4 space-y-4 overflow-y-hidden">
<div class="overflow-y-auto space-y-4">
<div class="flex justify-between">
<div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div>
<%= link_to "수정", schedule_edit_schedule_path(@controller.id), class: "btn bg-default-slate" %>
</div>
<ul class="divide-y divide-base-border">
<% @schedule.each do |s| %>
<li class="flex justify-between items-center px-4 py-2 space-x-4">
<div class="flex items-center space-x-6">
<!-- 시간 -->
<div class="flex flex-col md:flex-row items-baseline space-x-2">
<div class="text-white">시간</div>
<div class="text-3xl flex items-baseline space-x-1">
<div><%= s.hour.to_s.rjust(2, '0') %></div>
<div>:</div>
<div><%= s.minute.to_s.rjust(2, '0') %></div>
</div>
</div>
<!-- 온도 -->
<div class="flex flex-col md:flex-row items-baseline space-x-4">
<div class="text-white">온도</div>
<div class="text-3xl flex items-end space-x-2">
<div><%= s.temperature %></div>
<div class="text-white text-xl leading-8">°C</div>
</div>
</div>
</div>
<!-- 사용 여부 -->
<div class="flex flex-col md:flex-row items-baseline space-x-4">
<div class="text-white mb-1">사용여부</div>
<div class="text-3xl">
<%#= s.is_active %>
<% if s.is_active %>
<i class="fa-solid fa-check text-notice"></i>
<% else %>
<i class="fa-solid fa-xmark text-danger"></i>
<% end %>
</div>
</div>
</li>
<% end %>
</ul>
<!-- <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>-->
<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>
</div>

View File

@ -22,13 +22,13 @@ begin
end
end
rescue
# error_message = "[#{Time.now}] #{mode} 실행 실패 (station_id: #{controller_id}, value: #{value})"
# res = Sms.send_one(
# {
# to: '01062619801',
# from: '01062619801',
# text: error_message
# }
# )
# puts res
error_message = "[#{Time.now}] #{mode} 실행 실패 (station_id: #{controller_id}, value: #{value})"
res = Sms.send_one(
{
to: '01062619801',
from: '01062619801',
text: error_message
}
)
puts res
end