v1 finished

This commit is contained in:
2026-06-17 22:30:32 -04:00
parent 521653e5de
commit d5cf541f6b
13 changed files with 1750 additions and 169 deletions
+42 -39
View File
@@ -3,10 +3,10 @@
<div class="text-4xl mb-10">
Services
</div>
<% unless @is_readonly %>
<% unless @editing %>
<div class="w-19/20 flex flex-none items-center justify-between ml-5 mb-2">
<div class="flex-none text-xl text-[#2FD400]">Edit</div>
<div class="grow h-[1px] mt-1 bg-[#2FD400]"></div>
<div class="flex-none text-xl text-[#<%= @accent_hex %>]">Edit</div>
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></div>
</div>
<% end %>
<div class="flex flex-col ml-10 space-y-2">
@@ -16,73 +16,73 @@
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
id="serv_<%= index %>_name"
name="services[][name]"
value="<%= serv.name %>"
<%= 'readonly' if @is_readonly %> >
<%= 'readonly' if @editing %> >
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">Name</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">Name</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<select class="h-8 border-2 border-[#8000FF] rounded-lg text-center" name="services[][service_type_id]" id="service_type_select" <%= 'disabled' if @is_readonly %> >
<select class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'name="services[][service_type_id]" id="service_type_select" <%= 'disabled' if @editing %> >
<option value="">Select a Service Type</option>
<% @service_types.each do |service_type| %>
<option value="<%= service_type.id %>" <%= "selected" if serv.service_type_id == service_type.id %>><%= service_type.name %></option>
<% end %>
</select>
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">Service Type</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">Service Type</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<select class="h-8 border-2 border-[#8000FF] rounded-lg text-center" name="services[][machine_id]" id="machine_select" <%= 'disabled' if @is_readonly %> >
<select class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'name="services[][machine_id]" id="machine_select" <%= 'disabled' if @editing %> >
<option value="">Select a Service Type</option>
<% @machines.each do |machine| %>
<option value="<%= machine.id %>" <%= "selected" if serv.machine_id == machine.id %>><%= machine.name %></option>
<% end %>
</select>
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">Machine</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">Machine</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
id="serv_<%= index %>_subdomain"
name="services[][subdomain]"
value="<%= serv.subdomain%>"
<%= 'readonly' if @is_readonly %> >
<%= 'readonly' if @editing %> >
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">Subdomain</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">Subdomain</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
id="serv_<%= index %>_port"
name="services[][port]"
value="<%= serv.port%>"
<%= 'readonly' if @is_readonly %> >
<%= 'readonly' if @editing %> >
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">Port</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">Port</div>
<% end %>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class='h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center <%= "text-[##{@accent_hex}]" if !@editing %>'
id="serv_<%= index %>_url_path"
name="services[][url_path]"
value="<%= serv.url_path%>"
<%= 'readonly' if @is_readonly %> >
<%= 'readonly' if @editing %> >
<% if index == @services.length - 1 %>
<div class="text-[#2FD400]">URL Path (optional)</div>
<div class="<%= "text-[##{@accent_hex}]" if @editing %>">URL Path (optional)</div>
<% end %>
</div>
@@ -92,82 +92,85 @@
<div class="flex flex-col space-y-2 mt-10">
<% if @is_readonly %>
<div class="w-19/20 flex justify-end space-x-5">
<a href="/admin/services/edit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#8000FF] border-2 border-[#8000FF] rounded-lg hover:text-[#2FD400] hover:bg-[#140029] hover:border-[#2FD400] transition-colors duration-200">
<% if @editing %>
<div class="w-19/20 flex ml-10 space-x-5">
<a href="/admin/services/edit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#<%= @light_hex %>] border-2 border-[#<%= @light_hex %>] rounded-lg hover:text-[#<%= @accent_hex %>] hover:bg-[#<%= @dark_hex %>] hover:border-[#<%= @accent_hex %>] transition-colors duration-200">
Edit/Add Services
</a>
<a href="/admin" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#<%= @dark_hex %>] hover:border-[#F80800] transition-colors duration-200">
Back To Admin
</a>
</div>
<% else %>
<div class="w-19/20 flex flex-none items-center justify-between ml-5 mb-2">
<div class="flex-none text-xl text-[#2FD400]">New</div>
<div class="grow h-[1px] mt-1 bg-[#2FD400]"></div>
<div class="flex-none text-xl text-[#<%= @accent_hex %>]">New</div>
<div class="grow h-[1px] mt-1 bg-[#<%= @accent_hex %>]"></div>
</div>
<div class="flex space-x-2 mb-10 ml-10"">
<input type="hidden" name="services[][id]" value="">
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
id="serv_new_name"
name="services[][name]"
value="">
<div class="text-[#2FD400]">Name</div>
<div class="text-[#<%= @accent_hex %>]">Name</div>
</div>
<div class="flex flex-col items-center">
<select class="h-8 border-2 border-[#8000FF] rounded-lg text-center" name="services[][service_type_id]" id="service_type_select" <%= 'disabled' if @is_readonly %> >
<select class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center" name="services[][service_type_id]" id="service_type_select" <%= 'disabled' if @editing %> >
<option value="">Select a Service Type</option>
<% @service_types.each do |service_type| %>
<option value="<%= service_type.id %>"><%= service_type.name %></option>
<% end %>
</select>
<div class="text-[#2FD400]">Service Type</div>
<div class="text-[#<%= @accent_hex %>]">Service Type</div>
</div>
<div class="flex flex-col items-center">
<select class="h-8 border-2 border-[#8000FF] rounded-lg text-center" name="services[][machine_id]" id="machine_select" <%= 'disabled' if @is_readonly %> >
<select class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center" name="services[][machine_id]" id="machine_select" <%= 'disabled' if @editing %> >
<option value="">Select a Service Type</option>
<% @machines.each do |machine| %>
<option value="<%= machine.id %>"><%= machine.name %></option>
<% end %>
</select>
<div class="text-[#2FD400]">Machine</div>
<div class="text-[#<%= @accent_hex %>]">Machine</div>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
id="serv_new_subdomain"
name="services[][subdomain]"
value="">
<div class="text-[#2FD400]">Subdomain</div>
<div class="text-[#<%= @accent_hex %>]">Subdomain</div>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
id="serv_new_port"
name="services[][port]"
value="">
<div class="text-[#2FD400]">Port</div>
<div class="text-[#<%= @accent_hex %>]">Port</div>
</div>
<div class="flex flex-col items-center">
<input type="text"
class="h-8 border-2 border-[#8000FF] rounded-lg text-center"
class="h-8 border-2 border-[#<%= @light_hex %>] rounded-lg text-center"
id="serv_new_url_path"
name="services[][url_path]"
value="">
<div class="text-[#2FD400]">URL Path (optional)</div>
<div class="text-[#<%= @accent_hex %>]">URL Path (optional)</div>
</div>
</div>
<div class="w-19/20 flex justify-end space-x-5">
<button type="submit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#8000FF] border-2 border-[#8000FF] rounded-lg hover:text-[#2FD400] hover:bg-[#140029] hover:border-[#2FD400] transition-colors duration-200">
<div class="w-19/20 flex ml-10 space-x-5">
<button type="submit" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#<%= @light_hex %>] border-2 border-[#<%= @light_hex %>] rounded-lg hover:text-[#<%= @accent_hex %>] hover:bg-[#<%= @dark_hex %>] hover:border-[#<%= @accent_hex %>] transition-colors duration-200">
Save Services
</button>
<a href="/admin/services" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#140029] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#140029] hover:border-[#F80800] transition-colors duration-200">
<a href="/admin/services" class="inline-block w-50 px-3 py-1 mt-20 text-center font-semibold text-[#<%= @dark_hex %>] bg-[#F80800] border-2 border-[#F80800] rounded-lg hover:text-[#F80800] hover:bg-[#<%= @dark_hex %>] hover:border-[#F80800] transition-colors duration-200">
Cancel
</a>
</div>