diff --git a/app/views/rules/_form.html.erb b/app/views/rules/_form.html.erb index 30f170c0..99768cf3 100644 --- a/app/views/rules/_form.html.erb +++ b/app/views/rules/_form.html.erb @@ -1,6 +1,6 @@ <%# locals: (rule:) %> -<%= styled_form_with model: rule, class: "space-y-4 w-[550px]", +<%= styled_form_with model: rule, class: "space-y-6 w-[550px]", data: { controller: "rules", rule_registry_value: rule.registry.to_json } do |f| %> <%= f.hidden_field :resource_type, value: rule.resource_type %> @@ -10,17 +10,20 @@ <% end %>
-

- <%= lucide_icon("tag", class: "w-4 h-4") %> - Rule name (optional) -

-
+
+ <%= lucide_icon "tag", class: "w-4 h-4 shrink-0" %> +

Rule name (optional)

+
+
<%= f.text_field :name, placeholder: "Enter a name for this rule", class: "form-field__input" %>
-

If <%= rule.resource_type %>

+
+ <%= lucide_icon "help-circle", class: "w-4 h-4 shrink-0" %> +

IF

+
<%# Condition template, used by Stimulus controller to add new conditions dynamically %> - -
- +
+ - + +
-

Then

+
+ <%= lucide_icon "arrow-right", class: "w-4 h-4 shrink-0" %> +

THEN

+
<%# Action template, used by Stimulus controller to add new actions dynamically %> - +
+ - + +
-

Apply this

+
+ <%= lucide_icon "calendar", class: "w-4 h-4 shrink-0" %> +

FOR

+
-
+
<%= f.radio_button :effective_date_enabled, false, checked: rule.effective_date.nil?, data: { action: "rules#clearEffectiveDate" } %> - <%= f.label :effective_date_enabled_false, "To all past and future #{rule.resource_type}s", class: "text-sm text-primary" %> + <%= f.label :effective_date_enabled_false, "All past and future #{rule.resource_type}s", class: "text-sm text-primary" %>
diff --git a/app/views/rules/_rule.html.erb b/app/views/rules/_rule.html.erb index a86b8c54..abee6b2c 100644 --- a/app/views/rules/_rule.html.erb +++ b/app/views/rules/_rule.html.erb @@ -5,43 +5,62 @@ <% if rule.name.present? %>

<%= rule.name %>

<% end %> - <% if rule.conditions.any? %> -

- - <% if rule.conditions.first.compound? %> - If <%= rule.conditions.first.sub_conditions.first.filter.label %> <%= rule.conditions.first.sub_conditions.first.operator %> <%= rule.conditions.first.sub_conditions.first.value_display %> - <% else %> - If <%= rule.conditions.first.filter.label %> <%= rule.conditions.first.operator %> <%= rule.conditions.first.value_display %> - <% end %> - - <% if rule.conditions.count > 1 %> - and <%= rule.conditions.count - 1 %> more <%= rule.conditions.count - 1 == 1 ? "condition" : "conditions" %> - <% end %> -

+ <% if rule.conditions.any? %> +
+
+ <%= lucide_icon "help-circle", class: "w-4 h-4 shrink-0" %> + IF +
+

+ + <% if rule.conditions.first.compound? %> + <%= rule.conditions.first.sub_conditions.first.filter.label %> <%= rule.conditions.first.sub_conditions.first.operator %> <%= rule.conditions.first.sub_conditions.first.value_display %> + <% else %> + <%= rule.conditions.first.filter.label %> <%= rule.conditions.first.operator %> <%= rule.conditions.first.value_display %> + <% end %> + + <% if rule.conditions.count > 1 %> + and <%= rule.conditions.count - 1 %> more <%= rule.conditions.count - 1 == 1 ? "condition" : "conditions" %> + <% end %> +

+
<% end %> -

- - <% if rule.actions.first.value && rule.actions.first.options %> - <%= rule.actions.first.executor.label %> to <%= rule.actions.first.value_display %> - <% else %> - <%= rule.actions.first.executor.label %> +

+
+ <%= lucide_icon "arrow-right", class: "w-4 h-4 shrink-0" %> + THEN +
+

+ + <% if rule.actions.first.value && rule.actions.first.options %> + <%= rule.actions.first.executor.label %> to <%= rule.actions.first.value_display %> + <% else %> + <%= rule.actions.first.executor.label %> + <% end %> + + <% if rule.actions.count > 1 %> + and <%= rule.actions.count - 1 %> more <%= rule.actions.count - 1 == 1 ? "action" : "actions" %> <% end %> - +

+
- <% if rule.actions.count > 1 %> - and <%= rule.actions.count - 1 %> more <%= rule.actions.count - 1 == 1 ? "action" : "actions" %> - <% end %> -

- -

- <% if rule.effective_date.nil? %> - To all past and future <%= rule.resource_type.pluralize %> - <% else %> - To all <%= rule.resource_type.pluralize %> on or after <%= rule.effective_date %> - <% end %> -

+
+
+ <%= lucide_icon "calendar", class: "w-4 h-4 shrink-0" %> + FOR +
+

+ + <% if rule.effective_date.nil? %> + All past and future <%= rule.resource_type.pluralize %> + <% else %> + <%= rule.resource_type.pluralize %> on or after <%= rule.effective_date.strftime('%b %-d, %Y') %> + <% end %> + +

+